Results 1 to 6 of 6

Your favorite Apple, iPhone, iPad, iOS, Jailbreak, and Cydia site.


Thread: Root or Mobile - letting the program decide?

  1. #1
    Default Root or Mobile - letting the program decide?
    When accessing files via ObjC, is "~" recognized as the user's directory?
    I suppose if not, I can try the [UIApplication userHomeDirectory] method...
    does anyone knows if this works like I think it does? (i.e. does it return /private/var/root for firmware versions 1.1.2(-) and /private/var/mobile for firmware versions 1.1.3(+)?

    Thanks,
    JLA

    Okay, I've checked it out myself and here the results:

    I'm running 1.1.3 -

    [[NSString stringWithFormat: @"~/%@", @"Media/Skins"] stringByExpandingTildeInPath] = "/var/root/Media/Skins"

    [self userHomeDirectory] = "/var/root" -- i.e. the same effect as calling stringByExpandingTildeInPath on @"~"

    I'm not sure how it's root...I guess NateTrue 1.1.3 installation sets it that way...

  2. #2
    Quote Originally Posted by JLA View Post
    When accessing files via ObjC, is "~" recognized as the user's directory?
    I suppose if not, I can try the [UIApplication userHomeDirectory] method...
    does anyone knows if this works like I think it does? (i.e. does it return /private/var/root for firmware versions 1.1.2(-) and /private/var/mobile for firmware versions 1.1.3(+)?

    Thanks,
    JLA

    Okay, I've checked it out myself and here the results:

    I'm running 1.1.3 -

    [[NSString stringWithFormat: @"~/%@", @"Media/Skins"] stringByExpandingTildeInPath] = "/var/root/Media/Skins"

    [self userHomeDirectory] = "/var/root" -- i.e. the same effect as calling stringByExpandingTildeInPath on @"~"

    I'm not sure how it's root...I guess NateTrue 1.1.3 installation sets it that way...
    ~ is a UNIXism, therefore an OS X-ism. (OOPS)
    it means the home directory of the user who is running.
    it has nothing to do with the version of the iPhone. it has to do with where the app is running. (113 runs as mobile, others run as root)

    so under 113 it's user is mobile and ~ means /private/var/mobile

    if you want another's home directory try ~root or ~mobile as they are UNIXisms for the home directory of another user!

    PS Nate's is wack... code for the dev team standard!
    Last edited by jakecigar; 02-06-2008 at 09:36 PM.
    http://jpassoc.com/x -- with free itunes under the puppy!
    If I help you out, please press THANKS!

    3g QuickPWN'ed with 2.1

  3. #3
    ditto to what jake posted, except it's OS X-ism
    White 3G

  4. #4
    But that's not exactly what I was asking...I was asking whether the framworks recognize this. And the answer to this turned out to be: sortof. When I left the tilde in the path, the NSString file-handling methods didn't seem to translate it according to what it should be. But NSString does come with the handy "expand-the-tilde" method that does translate it, so that works. And the UIApplication method works as well.

    Quote Originally Posted by jakecigar View Post
    it has nothing to do with the version of the iPhone. it has to do with where the app is running.
    It does have to do with the version of the firmware...like you said, 1.1.3 is mobile, etc.
    And that's what I would think, except with my version 1.1.3...it returns root. I'm not sure if I'm running stuff as root or not. I believe the NateTrue version simply puts mobile as a symlink to root...perhaps what happens is that it gets the mobile directory but resolves the symlinks (mobile -> root) before returning the path string (i.e. returning the canonical name). Either way, it works fine...if the user directory resolves to root for either reason, I figure the program will have access to it...

    Thanks,
    JLA

  5. #5
    Nate's jail break, as you noticed, will return "/var/root/" for ~ due to the symlink
    The Dev teams jail break will return "/var/mobile/" for ~

    I have been using "stringByExpandingTildeInPath" since firmware 1.1.1 but I know it works in 1.0.2 so I would not say sort of, I'd say it works just fine.
    White 3G

  6. #6
    I said sort-of to refer to the fact that the frameworks in general don't translate the tilde--you can't use it (raw) to specify a file/directory, the exception being the tilde expansion method.

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •