Strings in Cocoa, Part 2
Subject:   strings in path of file with or without '/'...same?
Date:   2002-12-19 03:04:11
From:   anonymous2
hi mike,
i have just started studying cocoa programming through your columns. i've got questions below, i'm sorry if the answers might be so obvious as i still am a beginner.

From your column
NSString *shortPath = @"~/textFile.txt";
NSString *absolutePath = [shortPath stringByExpandingTildeInPath];

new path: /Users/mike/textFile.txt.
the reverse:

NSString *path = [absolutePath stringByAbbreviatingWithTildeInPath];

would set path to: ~/textFile.txt.
...this works well. but when i started out with the absolute path and have it converted to a short path using the stringByAbbreviatingWithTildeInPath, it doesn't abbreviate the path, the resulting path is the same. Does that mean that I really have to begin with the short path and then have it converted to the absolute path and then, abbreviate it again? and thus, when my first path is an absolute path, conversion to a short path is not possible? i tried this and it worked that way. why is this so?

from your column
NSString *path = @"Users/mike/textFile";

- i have observed that there is a difference between using
a) NSString *path = @"Users/mike/textFile"; and
b) NSString *path = @"/Users/mike/textFile";

letter 'a' is strange when such path is used to open the file...letter 'b' is, i think, the right one although it's not use for file opening/writing in this column.
or...will the two work? just that it would depend on some things?