Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
The shell script is missing some quotes.
Open Terminal.
Run this: open "$HOME/Library/Application Support/Steam/steamapps/common/Half-Life/"
Find the file "hl.sh"
Open it in a text editor and change the line that looks like:
GAMEROOT=$(cd ${0%/*} && echo $PWD)
Make it look like this:
GAMEROOT=$(cd "${0%/*}" && echo "$PWD")
The game will launch.
It worked! But what exactly did I change and why did it stop working?
The trouble comes from the fact that unix systems really really have a psychological allergy to directory names with spaces in them. This is because on the command line a space is what separates arguments and when directories have spaces, end looks like multiple args to the shell interpreter (you probably already don't care).
So, since the directory name has a space in it, you need to quote it. Otherwise it treats it as 2 args. Quoted properly it translates to a single argument.
The stuff between $() is executed in a subshell. Think of it like math. The parens execute first. So "cd" stands for 'change directory'. It tries to change directories into $HOME/Library Application in the first case. That directory doesn't exist, the command fails and the script exits. The double & is a logical operator. The second command only executes if on preceding it works. Since the 'change directory' failed, GAMEROOT was never set and the rest of the script peed its pants and ran off into the bushes.
In the second case, it tries to change to the directory called "$HOME/Library/Application Support/Steam/steamapps/common/Half-Life/". Since that directory exists (as evidenced by Finder opening it), the command works and the rest of the script works.
There's a bunch of other crap that the rest of the script does does, and the valve dev who didn't quote his paths gets no cookie, but that's the long and short of it.
I've been doing unix related work for the past 20 years so this stuff is old hat. In general you as a steam user aren't supposed to care about this stuff and really, i'm sure they'll patch it. It's just an oops. I found it by running steam in the terminal and just reading the errors. No biggie.
[cynic@Malediction ~]$ cat ./Library/Application\ Support/x.sh
#!/bin/bash
ME=$(dirname "$0")
echo "I am in $ME"
[cynic@Malediction ~]$ ./Library/Application\ Support/x.sh
I am in ./Library/Application Support
That ${0%/*} crap reads like a train wreck. Use basename and dirname as appropriate. The commands exist on linux and osx, most bsd systems and even slowlaris.