 |
 |
Filename having frontslash
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Dec 2008
Status:
Offline
|
|
Hi all,
I'm working on MAC carbon.
I want to create file having frontslash("/") in filename (ex: hello/world.pdf).
I used API fopen and open but these functions will consider the filename as path eventhough I escaped frontslash.
How can I create or open file containing frontslash(/) in its name.
Can any one provide code sniplet for that?
Thanks in advance.
|
|
|
| |
|
|
|
 |
|
 |
|
Moderator 
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status:
Offline
|
|
/ and : are not generally permitted in Mac filenames for compability purposes. : is the file-directory separator on Classic Mac OS, and / is the same in UNIX and the Openstep OS X was derived from. If you import a file from the classic OS with a / in it, it will be displayed in the Finder with a / and with a : in the Terminal. If you import a file with a : from a UNIX system, it will look the same. Both will be stored with a / in the name on HFS+ and with a : on UFS.
Carbon is just trying to save you from yourself. Escaping has nothing to do with it - that is not a legal filename.
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Dec 2008
Status:
Offline
|
|
Thanks for your replay.
But I have 1 question how the applications preview in mac is allowing
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Aug 2000
Location: Minneapolis, MN
Status:
Offline
|
|
Interesting point, I didn't realize the terminal would still show you the filename with a colon in it while the finder displays the slash.
I just tested renaming a file and adding a colon in the name via terminal. Guess what, the file in the finder displayed it as a slash.
$ mv "test.pdf" "test:testing.pdf"
yielded a file with the name "test/testing.pdf" when viewed from the finder. This may help you determine how to provide a workaround if the naming is critical to include the slash (at least visually). I can't imagine why this would be necessary as going-forward the names showing a slash, while useful in OS9, simply don't make sense to use in today's OS X.
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
On HFS+, internally, the character stored is a slash. Colons are illegal under HFS+. But the POSIX layer uses slashes as a path separator, so OS X translates between slashes and colons. So on most Macs, the Finder is actually showing you the correct name while the POSIX APIs are seeing a censored version.
(Last edited by Chuckit; Dec 18, 2008 at 11:11 PM.
)
|
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Oct 2000
Location: Los Angeles
Status:
Offline
|
|
Pretty crazy, I always thought HFS used colons because OS 9 path names had colons.
|

"The natural progress of things is for liberty to yield and government to gain ground." TJ
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
HFS+ does use colons as the path delimiter. But the colons you see on the command line (inside file names rather than dividing up folders) are actually slashes in the file system.
|
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|