Game Maker's Garage Forum

Game Creation => Code Exchange => Topic started by: GMG Kurt on November 01, 2011, 05:02:05 PM

Title: shell scripting
Post by: GMG Kurt on November 01, 2011, 05:02:05 PM
So as you know I've dabbled with shell scripting, trying to make an install script for GM, where you'd hide all of your images, sound, and random files in the application support folder.
I can understand all of it up to the point of locating the files. I found the means,  by copying from Russians ::) (I'm not kidding) the way we won the space race ;D (still not kidding.)

Code: [Select]
#!/bin/sh
cd `echo "$0"|cut -d "/" -f1-3`

My question is

HOW IN THE SEVEN HELLS DOES THAT EVEN WORK!!!
 :-X
Title: Re: shell scripting
Post by: Gan on November 01, 2011, 06:22:55 PM
Magic
Title: Re: shell scripting
Post by: GMG Kurt on November 03, 2011, 03:48:11 PM
I found one that makes more sense than this.

Code: [Select]
BASEDIR=$(dirname $0)
sets the directory to a variable

Code: [Select]
%~dp0
this returns it on windows.

I can finnish the GM installer for games that want to hide their files in application support.