discuss-gnustep
[Top][All Lists]
Advanced

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

Re: Copying files with special characters


From: Andreas Höschler
Subject: Re: Copying files with special characters
Date: Tue, 9 Sep 2008 23:35:09 +0200

Hi Fred and Nicolaus,

The method you are looking for is [NSFileManager fileSystemRepresentationWithPath:], but don't expect to much, it relies on [NSString defaultCStringEncoding].

system([[NSString stringWithFormat:@"cp -r '%s' '%s'", [sourcePath
fileSystemRepresentation], [destPath fileSystemRepresentation]]
cString]);

This is NOT safe for file names that include quotes.

Thanks for your hints. Yes, I fell over the cString conversion problem. It crashed my app. By utilizing lossyCString I was able to find a workaround. It works now more or less with spaces and special characters in the filename, though the special characters get kicked out when the file is written back to the filesystem. I can live with that.

Thanks a lot!

Regards,

 Andreas





reply via email to

[Prev in Thread] Current Thread [Next in Thread]