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: Fred Kiefer
Subject: Re: Copying files with special characters
Date: Tue, 09 Sep 2008 23:38:26 +0200
User-agent: Thunderbird 2.0.0.12 (X11/20071114)

Andreas Höschler wrote:
Dear all,

I would like to programmatically copy files with

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

or alternatively using NSFileManager. This works as long as sourcePath does not contain special characters like ä,ö,ü,...

In a terminal shell I can successfully copy such a file by typing

    cp "Germ

and then using TAB to automatically complete the path to

    cp "German Fa\314\210hrhaus.jpeg" /home/ahoesch/A00

The question for me now is where this magic \314\210 stuff comes from and how I can do the conversion in my GNUstep app programmatically before building the copy command.

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

Hints are greatly appreciated!

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

Fred




reply via email to

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