Set CWD to game folder on startup

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Someguynamedpie
Citizen
Posts: 71
Joined: Wed Mar 31, 2010 10:59 pm

Set CWD to game folder on startup

Post by Someguynamedpie »

Unless I'm doing something wrong, the CWD seems to be set to the folder LOVE is in. After all the libraries necessary in Love are initiated, it'd make sense to set the CWD to the game folder
User avatar
slime
Solid Snayke
Posts: 3160
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Set CWD to game folder on startup

Post by slime »

The current working directory is the current directory of the shell the user launched LÖVE from, if they're using a terminal. If not, it depends on the OS - in Mac OS X, the working directory is always "/" (the root) when LÖVE is launched as a regular application.

However that's all irrelevant for anyone writing code for LÖVE, because [wiki]love.filesystem[/wiki] is what you will use, and it doesn't use the system's current working directory. You shouldn't use io.open or loadfile in a LÖVE game - use love.filesystem.read (or [wiki]love.filesystem.newFile[/wiki]) and require or love.filesystem.load instead.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 0 guests