Reading partial file paths with the File object

For questions about using Classic.

Post » Wed Feb 09, 2011 10:48 pm

So, a simple (I hope) question, but one which I can't find the answer to anywhere:

Is there a way to tell the File object to start looking for a file in the directory my exported EXE is in, instead of always providing it with a full file path?

Right now the argument I'm using is:

File.LoadFileToString("C:\Users\John\Documents\pkg2.txt")

The obvious problem being that this will only work for people called John who run the game from their Documents folder :roll: . I really need to replace it with something like:

File.LoadFileToString("Current Directory\pkg2.txt")

But I just don't know how :( . Anyone have a clue how to do this?
B
1
G
2
Posts: 7
Reputation: 639

Post » Wed Feb 09, 2011 11:26 pm

Use: apppath + "folder\file.filetype"
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Thu Feb 10, 2011 1:56 am

That's exactly what I was looking for, thanks :) .
B
1
G
2
Posts: 7
Reputation: 639


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests