Re: Creating unique file names with Script-Fu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Gino D <ginodonig@xxxxxxxxx>:

>> I do not believe it is possible for a Script-fu to delete files. You
>> will need to either do this outside of GIMP or write a plug-in.
>
> Deletion of files is made possible by the “file-delete” procedure, as
> shown at the end of the sequence of commands I proposed in my initial
> post.

I hadn't realized that the TinyScheme Extensions had been enabled for  
Script-fu. If you choose to use the 'gimp-temp-name' approach I  
previously proposed then 'file-exists?' would be better than opening  
the file.

>> The following code snippet uses 'gimp-temp-name' -- which generates a
>> filename that has an extremely good chance of being unique...
>
> The idea of employing the “gimp-temp-name” procedure for generating a
> most likely unique file name is very interesting. Thanks for your
> suggestion and the snippet you devised. Pity that such procedure
> affects only the GIMP temporary directory; if it were effective in
> every folder, it would be great, especially for the issue we are
> discussing.
Even within the GIMP temporary directory, 'gimp-temp-name' does not  
actually guarantee uniqueness against files in the directory, so the  
only inconvenience of using 'gimp-temp-name' is having to parse out  
the filename from the full filepath.

> By chance, can you tell me if my previous conjectures about the
> priority of the exclamation point are correct, besides on Windows, on
> other operating systems too?

Your approach would not succeed on GNU/Linux platforms because  
'dir-read-entry' does not ensure that the entries are returned in  
alphabetical order. Even on Windows I suspect you will find that the  
order entries are retrieved is dependent upon the type of filesystem  
(FAT, VFAT, NTFS all behave differently).




_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer



[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux