Jump to content


Photo

Create executable with data files


  • Please log in to reply
3 replies to this topic

#1 heavyhorse

heavyhorse

    GMC Member

  • GMC Member
  • 10 posts
  • Version:GM7

Posted 28 July 2012 - 03:35 PM

Hello-

I am posting this Mac forum as there are some workarounds to my issue on Windows. In my game I am using data files (simple text files) - let us say abc.txt, xyz.txt, etc. In my code I am able to open them as -- working_directory+"/data/level1/"+"abc.txt"......
Everything works fine. When I create an executable and send it to anyone with the data file they are unable to use it as the app is looking specifically the working directory name in my computer i.e. /Users/myname/Desktop/ etc...
The only way someone else is able to play the game is my creating a user on their Macs with "myname" and cppying the data file there.

Any pointers or suggestions will be greatly appreciated. Thanks!

*** SOLVED *** (thanks to all who replied)

I have resolved this as follows:

1. Created a separate version of code to make the executable (seem to be the cleanest way to this)
2. In the Include option (GLobal Game Settings), I have selected the data files and indicated they be exported to a Temporary Folder (all other options create path name conflicts)
3. Did *not* select Remove files option!
4. CHanged my code to refer to use files from the temporary folder
5. Backed up all my data files and then created/tested the executable and it all works

Pl see the instructions here - http://gamemaker.inf.../302_06_include paying attention to all the bold text!

Edited by heavyhorse, 30 July 2012 - 01:36 PM.

  • 0

#2 policejohn99

policejohn99

    Fist Studios Owner

  • GMC Member
  • 88 posts
  • Version:GM8

Posted 28 July 2012 - 04:35 PM

Hello-

I am posting this Mac forum as there are some workarounds to my issue on Windows. In my game I am using data files (simple text files) - let us say abc.txt, xyz.txt, etc. In my code I am able to open them as -- working_directory+"/data/level1/"+"abc.txt"......
Everything works fine. When I create an executable and send it to anyone with the data file they are unable to use it as the app is looking specifically the working directory name in my computer i.e. /Users/myname/Desktop/ etc...
The only way someone else is able to play the game is my creating a user on their Macs with "myname" and cppying the data file there.

Any pointers or suggestions will be greatly appreciated. Thanks!


there is a LIB for opening a text document use it use the name of the text document lets say ABC.txt then put the executable in a folder zipped or normal and it should work fine. LIB comes with the GM8 already installed. Press the + if this helped :D.
  • 0

#3 heavyhorse

heavyhorse

    GMC Member

  • GMC Member
  • 10 posts
  • Version:GM7

Posted 28 July 2012 - 06:14 PM


Hello-

I am posting this Mac forum as there are some workarounds to my issue on Windows. In my game I am using data files (simple text files) - let us say abc.txt, xyz.txt, etc. In my code I am able to open them as -- working_directory+"/data/level1/"+"abc.txt"......
Everything works fine. When I create an executable and send it to anyone with the data file they are unable to use it as the app is looking specifically the working directory name in my computer i.e. /Users/myname/Desktop/ etc...
The only way someone else is able to play the game is my creating a user on their Macs with "myname" and cppying the data file there.

Any pointers or suggestions will be greatly appreciated. Thanks!


there is a LIB for opening a text document use it use the name of the text document lets say ABC.txt then put the executable in a folder zipped or normal and it should work fine. LIB comes with the GM8 already installed. Press the + if this helped :D.


I am using the Mac GM7 version unfortunately; can we get access to the source code? Besides I am surprised not to find any forum posting on this topic. I wonder how people are working with data (non-ini or configuration related) without a database or text files.
  • 0

#4 Dangerous_Dave

Dangerous_Dave

    GMC Member

  • Global Moderators
  • 9276 posts
  • Version:Unknown

Posted 29 July 2012 - 05:28 AM

You should be able to use working_directory fine, but note that this usually returns a folder *inside* the app (which is actually a folder, you can right click on the app and choose Show package contents to see the internal folders.

Use a show_message to check the directory being returned for working_directory and make sure your files are stored appropriately.

If you are altering the files, these should be stored in the application data directory, not within the app. Note that this should be the same on Windows, to follow correct convetions.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users