Skip to content

Commit

Permalink
added __ssave_get_save_directory because i dont trust people
Browse files Browse the repository at this point in the history
  • Loading branch information
stoozey committed Oct 16, 2022
1 parent 2eeead0 commit 01a3500
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions scripts/__scr_ssave_util/__scr_ssave_util.gml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ function __ssave_print()
return show_debug_message(_string);
}

function __ssave_get_save_directory()
{
if (SSAVE_DIRECTORY == "") return SSAVE_DIRECTORY;

var _lastChar = string_char_at(SSAVE_DIRECTORY, string_length(SSAVE_DIRECTORY));
if ((_lastChar == "/") || (_lastChar == "\\")) return SSAVE_DIRECTORY;

return (SSAVE_DIRECTORY + "/");
}

function __ssave_string_to_buffer(_string)
{
var _buffer = buffer_create(string_byte_length(_string), buffer_fixed, 1);
Expand Down
2 changes: 1 addition & 1 deletion scripts/scr_ssave/scr_ssave.gml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ function SSave(_name = "data", _protection = SSAVE_PROTECTION_DEFAULT) construct

static __get_filename = function(_prefix = "")
{
return (SSAVE_DIRECTORY + _prefix + __name + "." + __SSAVE_FILE_EXTENSION);
return (__ssave_get_save_directory() + _prefix + __name + "." + __SSAVE_FILE_EXTENSION);
}

static __generate_output_struct = function()
Expand Down
2 changes: 1 addition & 1 deletion scripts/scr_ssave_config/scr_ssave_config.gml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#macro SSAVE_DIRECTORY "" // The directory that saves are saved to. This must end with a slash!
#macro SSAVE_DIRECTORY "" // The directory that saves are saved to.

#macro SSAVE_PROTECTION_DEFAULT SSAVE_PROTECTION.NONE // How the save data is protected in the output file
#macro SSAVE_ENCRYPTION_KEY 69420133769696969694204872936 // When using SSAVE_PROTECTION.ENCRYPT, this is the key used to encrypt it

0 comments on commit 01a3500

Please sign in to comment.