Description

[Made for GameMaker Studio 2]

This extension is for Windows, macOS, and Ubuntu.

Manage files/folders without a sandbox; overrides GameMaker Studio 2's built-in functions.

Each function that does not return a string, will return true on success, and false on failure.

Functions included:

  • real file_copy(string fname,string newname)

  • real file_rename(string oldname,string newname)

  • real file_exists(string fname)

  • real file_delete(string fname)

  • real directory_create(string dname)

  • real directory_copy(string dname,string newname)

  • real directory_rename(string oldname,string newname)

  • real directory_exists(string dname)

  • real directory_destroy(string dname)

  • string environment_get_variable(string name)

  • real environment_set_variable(string name, string value)

  • string get_working_directory()

  • real set_working_directory(string dname)

  • string get_program_directory()

  • string get_temp_directory()

The DLL's full source code included.

Very big thanks to Josh Ventura, for writing the widen() and shorten() scripts, enabling UTF-8 support on Windows.

get_working_directory() will return the Unix working directory on Mac, which defaults to your system root "/". At the beginning of your game, you may change this to whatever you like, but I recommend your app bundle's "Resources" folder, which you may set it to with the GML Script - generate_working_directory().

End User Licence Agreement (EULA).

Changes in 2.4.0

Please replace all Scripts and Included Files in your existing projects to apply this update!!!

  • [macOS] [Ubuntu] Fixed a safety issue with the use of the POSIX functions dirname() and basename().

Version 2.4.0. Published March 2, 2019

Created with GameMaker: Studio v1.4.1804

Age Rating: 4+

Average Rating

Your review

You can only review assets you've bought.


Gravatar

Anonymous 21 April 2019


Gravatar

Brandon S 25 November 2018

This review was left for a previous version of this asset.


Gravatar

Anonymous 08 October 2018

This review was left for a previous version of this asset.


Gravatar

Paul C 01 September 2018

Great!

Great cross-platform solution for out-of-the-sandbox file access.

I've tested this on my game on both windows and Mac and it works smoothly on both platforms.

At the time of writing there is a bug in the built-in GML functions that prevents getting out of the sandbox, so this solution is perfect for my needs.

Author has been responsive and adding updates to the asset frequently.

This review was left for a previous version of this asset.

Logo

Samuel Venable (Publisher) 04 September 2018

Hi Paul C.

Thank you for the positive review. I am glad I was able to help!

Regards
Samuel


Gravatar

Anonymous 22 August 2018

This review was left for a previous version of this asset.


Gravatar

Anonymous 14 March 2018

No problems yet

Works great! Just what I needed!

This review was left for a previous version of this asset.


Gravatar

Amy M 15 January 2018

Works great!

This seems to work exactly as it should, thanks! Any chance of Mac compatibility in the future?

This review was left for a previous version of this asset.

Logo

Samuel Venable (Publisher) 15 August 2018

Hi Amy M.

Support for macOS has been officially added today. :)

Regards,
Samuel


Gravatar

Anonymous 02 December 2017

Writing to files?

It works great if you're just pulling in a bunch of read-only files dynamically, but I can't seem to write to the save area then copy that file elsewhere using file_copy_fmns().

This review was left for a previous version of this asset.

Logo

Samuel Venable (Publisher) 04 December 2017

Hi.

Try this, which I just tested and verified it works on my end:

f = file_text_open_write(game_save_id + "example.txt");
file_text_write_string(f, "this is an example text file");
file_text_close(f);

file_copy_fmns(game_save_id + "example.txt", working_directory + "example.txt");

/* Basically, you write/edit files when they are in your sandbox folder (a.k.a. game_save_id).
Then, you can copy the files in and out of there as needed. Remember to test a compiled game.

Enjoy!
Samuel


Gravatar

Anonymous 20 August 2017

This guy is honestly the best :)

The rename script doesn't work for me. All it just does it delete the file when it attempts to rename it.

The code [Left Pressed]

if global.fileopen = ""
{
show_message("No File Selected")
} else {
newname = get_string("Enter a new name for this file",string (filename_name(global.fileopen)))
file_rename_fmns((global.fileopen),newname)
}
#####################################
global.fileopen = a file that the user opened

EDIT
(Thanks, it works now)

This review was left for a previous version of this asset.

Logo

Samuel Venable (Publisher) 20 August 2017

Hi. Thanks for the review and compliment. :)

It's not working because you need to specify the path to the file for both arguments.

As an example, if you are using get_open_filename, you may use filename_path like so:

// Left Pressed
global.fileopen = get_open_filename("","")
if global.fileopen = ""
{
show_message("No File Selected")
} else {
newname = get_string("Enter a new name for this file",string(filename_name(global.fileopen)))
file_rename_fmns((global.fileopen),filename_path(global.fileopen)+newname)
}

Package contents

Loading, please wait

What is the issue?

Back to Top