Forums

Issue with creating directories with script

Auteur Réponses
boat Vendredi 4 Octobre 2013 à 15:43
boat

Hello! If this is the wrong subforum to post things like these in then I kindly apologize for the inconvenience. On to the point, I've been working on a script and have run into an issue at the last step, creating a custom directory for the .exe to run from.
This is probably a silly question and really easy to do, but I'm not particularly literate within the subject and can't get it to work.

After having made a prefix I'm trying to create a directory in the Program Files folder of it, and the issue is that cd doesn't want to change the directory without the "home/user/" part in front of .PlayOnLinux/wineprefix/newprefix/drive_c/Program Files". If I specify "home/boat" then everything works, but without nothing happens, and this is probably expected behaviour, but I don't really know any other way to do this in. Any help would be appreciated, thank you.

Edit: Additionally, the new directory requires an exclamation mark in the name. I couldn't get this to work either and would highly appreciate any suggestions for a solution to this. Thanks.

Another edit: I sorted it out. I missed the part about $HOME, got it working now. Thank you anyways! :^D

Edité par boat

petch Vendredi 4 Octobre 2013 à 16:41
petch

Talking about that, don't expect PlayOnLinux to live in $HOME/.PlayOnLinux, use $POL_USER_ROOT; Don't expect prefixes to live in $POL_USER_ROOT/wineprefix, use $WINEPREFIX (set once the prefix has been selected); And don't expect "Program Files" to be named that way, as it depends on the locale, use $PROGRAMFILES instead.
boat Vendredi 4 Octobre 2013 à 17:42
boat

Thank you, I fixed this. 

Edité par boat

boat Vendredi 4 Octobre 2013 à 18:43
boat

So after changing it to
cd "$POL_USER_ROOT/$WINEPREFIX/osu_on_linux/drive_c/$PROGRAMFILES"
  
mkdir "osu!"
  
cd "$POL_USER_ROOT/$WINEPREFIX/osu_on_linux/drive_c/$PROGRAMFILES/osu!"
  
POL_Download http://osu.ppy.sh/release/osume.exe


And having it working for a while, it suddenly stopped doing so. I'm not sure what the issue here is.
petch Vendredi 4 Octobre 2013 à 19:12
petch

$WINEPREFIX points to the root of the Wine prefix, so you just need
mkdir "$WINEPREFIX/drive_c/$PROGRAMFILES/osu!"
cd "$WINEPREFIX/drive_c/$PROGRAMFILES/osu!" || POL_Debug_Fatal "Failed to change directory"


cd then mkdir is bad style: if the cd fails (because the path doesn't exist or for whatever other reason, access rights, etc.) you'll be creating a subdirectory in the current directory, which can be almost anything...

This site allows content generated by members, and we promptly remove any content that infringes copyright according to our Terms of Service. To report copyright infringement, please send a notice to dmca-notice@playonlinux.com