Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » File/Folder deleting, Recycle Bin and Read only files
Re: File/Folder deleting, Recycle Bin and Read only files [message #24207 is a reply to message #24206] Tue, 05 January 2010 15:11 Go to previous messageGo to previous message
koldo is currently offline  koldo
Messages: 3372
Registered: August 2008
Senior Veteran
Hello Honza

Thank you for reading the long post.

Smile Some comments:

Quote:

It's interesting idea, but it's definitely not multiplatform. On Linux filesystems read-only usually means you simply don't have the permission to delete the file.

If my user have the permission, it can change the file attributes using chmod() in Linux.

Confused See bool FileSetReadOnly(String fileName, bool readOnly) implementation in Functions4U Bazaar package..

Quote:

Also recycle bin might not be available

As far as I know Gnome and Kde desktops have Recycle Bin (or Trash Bin). At least in case of Gnome and Ubuntu derivatives, Trash Bin is located in a fixed folder.

Confused See bool FileToTrashBin(const char *path) implementation in Functions4U Bazaar package.

Quote:

and even when it is then its behaviour and implementation differs in each desktop environment.

Smile No problem, Upp packages have some internal #ifdef PLATFORM_POSIX and many other so that the final user does not have to worry about OS/Desktop particular behaviours.

Quote:

Thinking about it, another way to achieve this would be to implement function that manages file attributes. (Or is there something like that in upp already?) Then you could just delete the read-only flag and delete it. For recycle bin I would suggest special function to. It feels "cleaner" to me to add

#ifdef PLATFORM_WIN32
SetAttributes(int Attr);
MoveToRecycleBin(const char* File);
#endif

instead of changing the existing functions in win32 specific way...

Confused These functions are already implemented in Functions4U Bazaar package as:
bool FileToTrashBin(const char *path);
int64 TrashBinGetCount();
bool TrashBinClear();
bool FileSetReadOnly(String fileName, bool readOnly);


They could be reimplemented, renamed and transfered to Core package... the problem is that derived functions would have to be changed like actual
bool DeleteFolderDeep(const char *dir)
...

I would not like to have a
bool FileToTrashBinDeep(const char *dir)

SetAttributesDeep(String folder, int Attr)


and different version handling Trash Bin and Read permissions for the rest of functions that use FileDelete or DirectoryDelete Sad

Best regards
Koldo


Best regards
IƱaki
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: crash on exit from XmlView example
Next Topic: Little .ini reading request
Goto Forum:
  


Current Time: Fri Jun 07 03:01:17 CEST 2024

Total time taken to generate the page: 0.01917 seconds