PND_RUN.SH command line problem


Sigma

Still Fresh
Joined
Dec 11, 2010
Messages
41
Location
The Netherlands
I hope someone can point me into the right direction, I've got the following issue


for a Emu frontend I would like start a program from a PND file (through commandline, well that's working


with the pnd_run.sh script and with the pnd_run.sh script you can send some argument (-a "arguments")


so for starting snes9x and load a rom I can use this command:


pnd_run.sh -p /media/SDHC/sigma/snes/snes9x4p_20101111.pnd -e snes9x -a "/media/SDHC/roms/snes/ActRaiser.smc"


that working great but now my problem occurs, when I use a rom with a space in the name like for example: ActRaiser 2.smc


I use this command:


pnd_run.sh -p /media/SDHC/sigma/snes/snes9x4p_20101111.pnd -e snes9x -a "/media/SDHC/roms/snes/ActRaiser\ 2.smc"


but that's not working and when I look at the pnd output I've noticed that from the -a "/media/SDHC/roms/snes/ActRaiser\ 2.smc"


only this: "2.smc" is forwarded that's why my rom isn't loaded in the emulator


error log:


none on /mnt/utmp/snes9x4p_20101111 type aufs (rw,si=6c1d2157,noplink)


[------------------------------]{ App start }[-------------------------------$


Snes9X: Memory allocation failure - not enough RAM/virtual memory available.


S9xExiting...


Rate: 32000, Buffer size: 512, 16-bit: yes, Stereo: yes, Encoded: no


Error opening: 2.smc


[-------------------------------]{ App end }[--------------------------------$


cleanup done


I have tried many things like:


-a '/media/SDHC/roms/snes/ActRaiser\ 2.smc'


'-a "/media/SDHC/roms/snes/ActRaiser\ 2.smc"'


when I run pnd_run.sh I get the message:


#Usage: pnd_run.sh -p your.pnd -e executeable [-a "(arguments)"] [ -s "cd to folder inside pnd"] [-b UID (name of mountpoint/pandora/appdata)] [-x close x before launching(script needs to be started with nohup for this to work]


# -s startdir


# arguments can be inside -e, -a is optional


saying -a is optional and that argument can be inside -e , but that's not working tried:


snes9x4p_20101111.pnd -e snes9x "/media/SDHC/roms/snes/ActRaiser\ 2.smc"


snes9x4p_20101111.pnd -e snes9x "/media/SDHC/roms/snes/ActRaiser\ 2.smc"


snes9x4p_20101111.pnd -e "snes9x /media/SDHC/roms/snes/ActRaiser\ 2.smc"


maybe someone knows a other way of sending names with spaces in it throught command line other than between quotes like this "name space"
 
might be worth checking if the emulator accepts roms with spaces in the names, it'll come down to how the commadn line options are parsed, and whether it's read until delimiter (so, space in this case), or read until "
 
because your wrapping the path in quotes cant you keep the space in tact instead of trying to escape it with a backslash?


i.e.


-a "/media/SDHC/roms/snes/ActRaiser 2.smc"
 
might be worth checking if the emulator accepts roms with spaces in the names, it'll come down to how the commadn line options are parsed, and whether it's read until delimiter (so, space in this case), or read until "


emulator accept roms with space tied that and that's working, It has to something the -a does with the arguments it passes


down don't know why it's cutting it down to "2.smc" it's lost somewhere in the process
 
because your wrapping the path in quotes cant you keep the space in tact instead of trying to escape it with a backslash?


i.e.


-a "/media/SDHC/roms/snes/ActRaiser 2.smc"


actually the frontend I use does send it like you mention and I though that would be the problem that's why


I'm trying through command line without the frontend


when I try this: snes9x "/media/SDHC/roms/snes/ActRaiser\ 2.smc" it runs the rom like it should be.
 
If it were me, I would just rename the SMC file to ActRaiser2.smc, no spaces.
 
Found a solution :p


just need to change a line in the PND_RUN.SH


original:


"./$EXENAME" $ARGUMENTS


new:


"./$EXENAME" "$ARGUMENTS"


and that works I think this needs to be a default setting, anyone who's where to put the request to modify the


PND_RUN.SH to add it in future releases


grtz
 
Please use the lastest pnd_run.sh and report back. I did have introduced a bug in the argument parsing but it should be now fixed.


thnx


tried it but didn't work, the option I found "./$EXENAME" "$ARGUMENTS" works,


could you please add some quotes to the $ARGUMENTS variable,


so we can use spaces in directory or files


grtz
 
Last edited by a moderator:
tried it but didn't work, the option I found "./$EXENAME" "$ARGUMENTS" works,


could you please add some quotes to the $ARGUMENTS variable,


so we can use spaces in directory or files


grtz
That will broke multi-arguments too. With your solution, all the arguments are seen as only one by the executable now. That will break documentation :(
 
tried it but didn't work, the option I found "./$EXENAME" "$ARGUMENTS" works,


could you please add some quotes to the $ARGUMENTS variable,


so we can use spaces in directory or files


grtz
That will broke multi-arguments too. With your solution, all the arguments are seen as only one by the executable now. That will break documentation :(

documentation can be fixed :) but multi-arguments I don't know, I know some things about scripting but this is


a little out of my league, do you have a other solution?


otherwise I have to use a customized pnd_run.sh file just for the frontend.
 
documentation can be fixed :) but multi-arguments I don't know, I know some things about scripting but this is


a little out of my league, do you have a other solution?


otherwise I have to use a customized pnd_run.sh file just for the frontend.

You do have more solutions :


Try pnd_run.sh -p /media/SDHC/sigma/snes/snes9x4p_20101111.pnd -e snes9x -a "'/media/SDHC/roms/snes/ActRaiser\ 2.smc'" (I did add single quote inside the double one)


or else


1) Mount the PND :


pnd_run.sh -p /media/SDHC/sigma/snes/snes9x4p_20101111.pnd -e snes9x -m


2) Run the command :


/mnt/utmp/snes9x4p/snes9x "/media/SDHC/roms/snes/ActRaiser 2.smc"


3) unount the PND :


pnd_run.sh -p /media/SDHC/sigma/snes/snes9x4p_20101111.pnd -e snes9x -u


 
You do have more solutions :


Try pnd_run.sh -p /media/SDHC/sigma/snes/snes9x4p_20101111.pnd -e snes9x -a "'/media/SDHC/roms/snes/ActRaiser\ 2.smc'" (I did add single quote inside the double one)


or else


1) Mount the PND :


pnd_run.sh -p /media/SDHC/sigma/snes/snes9x4p_20101111.pnd -e snes9x -m


2) Run the command :


/mnt/utmp/snes9x4p/snes9x "/media/SDHC/roms/snes/ActRaiser 2.smc"


3) unount the PND :


pnd_run.sh -p /media/SDHC/sigma/snes/snes9x4p_20101111.pnd -e snes9x -u


 
try


"'/media/SDHC/roms/snes/ActRaiser 2.smc'"


(since the backslash inside single quotes will probably not work)


or


"/media/SDHC/roms/snes/ActRaiser\\ 2.smc"


(I doubt this will work, but it's worth a try - the reason behind it is that the "\ " could be eaten by the command line and therefore vanish when put in the $ARGUMENTS variable, but a double-backslash would translate to a single one in the $ARGUMENTS which in turn would work as a proper space escape when delivered to the $EXENAME. At least, that's the theory)
 
try


"'/media/SDHC/roms/snes/ActRaiser 2.smc'"


(since the backslash inside single quotes will probably not work)


or


"/media/SDHC/roms/snes/ActRaiser\\ 2.smc"


(I doubt this will work, but it's worth a try - the reason behind it is that the "\ " could be eaten by the command line and therefore vanish when put in the $ARGUMENTS variable, but a double-backslash would translate to a single one in the $ARGUMENTS which in turn would work as a proper space escape when delivered to the $EXENAME. At least, that's the theory)

Thnx I'll try the Theory ;) and the other settings.


grtz
 
I just ran into this issue when trying to use pnd_assoc from PND_utils on music files with spaces in their names.


My solution was to patch pnd_run.sh to accept -A as a flag which means "all one argument" and then to patch pnd_assoc to call pnd_run.sh with it.
 
Back
Top