Changing permissions within an app

Discussion in 'Jiggy Runtime Development' started by rob spriggs, Jun 16, 2008.

  1. rob spriggs

    rob spriggs New Member

    Joined:
    Jan 26, 2008
    Messages:
    28
    Likes Received:
    0
    Hi,

    first can any one please explain why this code:


    {
    if (button == 1)
    {
    executeShellCommand('/bin/chmod -R 0755 /Applications/*/*');
    }

    if (button == 2)
    {
    executeShellCommand('launchctl stop com.apple.SpringBoard');
    }
    };


    will only work if i run the application through the teminal command via ssh and executing it? if i run it from the springboard then the permissions will not change.

    also how do you get jiggy to connect to wifi? it seems that every time i connect to my laptop, when i press the home button it cuts of my connection. i have to connect it up the execute jiggy via the terminal as well.

    any ideas, thanks in advance

    ps thanks for all the helpfull threads that have saved me loads of time, just by reading them
  2. gojohnnyboi

    gojohnnyboi Well-Known Member

    Joined:
    Jan 25, 2008
    Messages:
    3,339
    Likes Received:
    55
    You should read up on the unix permissions and permission qualifications.


    You should know that an application that is running mobile such as the ones on 1.1.4 have far less permissions then root applications, so the application cannot chmod another application unless it has +s permissions.


    Example:

    Your app - chmod -R +s /Applications/Yourapp.app
  3. rob spriggs

    rob spriggs New Member

    Joined:
    Jan 26, 2008
    Messages:
    28
    Likes Received:
    0
    christ that was a quick reply, thanks for your help ill give it a go.

    cheers
  4. rob spriggs

    rob spriggs New Member

    Joined:
    Jan 26, 2008
    Messages:
    28
    Likes Received:
    0
    ok i have given it ago and it sort of works, once i put in that command that was given then the app works for the first time, prob is that after the command has gone throgh it then changes the permissions on me own app back to normall.

    is there any way for my program to change the permissions on everything in /Applications apart from a certain folder?

    hopefully that makes sense to someone out there.

    thanks in advance
  5. PAEz

    PAEz New Member

    Joined:
    Jan 29, 2008
    Messages:
    201
    Likes Received:
    10
    I havent got an iTouch on me so cant test this, but...
    You could just get the contents of the Applications directory and change the permissions on every dir/file but yours...(this needs iuikit from geekgoodnes coz im lazy...dir_list).....
    Code:
    var newList = dir_list( tabDir + newDir.dir + '/' );
    	for( var i in newList ){
    if (newlist[i] != "your apps directory") changepermissionof("/Applications/"+newList[i]);
    	}	
    ...well that wont work as is offcourse, but hopefully gives you an idea of what you could do
  6. gojohnnyboi

    gojohnnyboi Well-Known Member

    Joined:
    Jan 25, 2008
    Messages:
    3,339
    Likes Received:
    55

    If you want to modify every file/folder within a directory use the -r(recursive) argument.

    Code:
    chmod -R +s /Applications
  7. PAEz

    PAEz New Member

    Joined:
    Jan 29, 2008
    Messages:
    201
    Likes Received:
    10
    He wanted to change every file/dir in a dir except one, so recursion aint gonna cut it.
    Do you know of an addition that can be made to the command line to recurse but exclude one directory?....i had a look around but couldnt find anything, but then i dont know unix.

Share This Page