[Gambas-user] Patch with non text files?

Benoît Minisini gambas at ...1...
Sun Jun 15 14:42:09 CEST 2014


Le 15/06/2014 14:16, Tobias Boege a écrit :
> On Sun, 15 Jun 2014, Antonio S??nchez wrote:
>> Hi, is there any way to create a patch in Gambas in a project where you
>> have added new non text files as images or sounds?
>>
>
> There is no difference between text and non-text files as far as it concerns
> the programs "diff" and "patch" which are used by the IDE for patching. It
> just happens that the IDE tests for the patch to be a text file. We have to
> blame Benoit for that behaviour ;-)
>
> $ svn blame FPatch.class | grep -B1 -A2 look
> 5835     gambas   If Not Project.IsTextFile(Dialog.Path) Then
> 5835     gambas     Message.Warning(("That file does not look like a patch file!"))
> 5835     gambas     Return
> 5835     gambas   Endif
>
> I'll fix it in one of the next revisions.
>
> Benoit, if there is a reason you added this code, please tell me and feel
> free to revert my commit. However, the commit message for #5835 doesn't say
> anything about it.
>
> Regards,
> Tobi
>

I think I added that just to prevent the user to choose a file by 
mistake. I don't know what "patch" will do with a random file, and so I 
wanted to prevent it from transforming the project into garbage.

So if you have a way to detect if a file is actually a patch or not, I 
suggest you create a Project.IsPatchFile() and use it in the test.

Regards,

-- 
Benoît Minisini




More information about the User mailing list