Windows Saving location doesn't work

R

Rommel76

Guest
Hi everybody

I am running the latest version 2.2.3.346, runtime v2.2.3.244

I already disabled the sandbox restriction and anyway I am unable save the files in a defined directory .

as follow the creation code :


file = "http://www.**********.com/Test" // link al file
des = "\Download\Upgrade.zip"
download = http_get_file(file,des);
size = 0 ;
progress = 0 ;
image_speed = 0

The async http code :

if ds_map_find_value(async_load,"id") = download {
if ds_map_find_value(async_load,"status") = 1 {
size = ds_map_find_value(async_load,"contentLength")
progress = ds_map_find_value(async_load,"sizeDownloaded")

}else if ds_map_find_value(async_load,"status") = 0{
show_message("File download")}
else {show_message("Download failed")
}

}


Everything works , the file has been downloaded but has been saved properly only in the appdata directory only if I don't define any directory , with des = "\Download\Upgrade.zip" the file has been download but don't be saved anywhere , the same thing with any other folder i try .

what can I do ? , I am trying and trying since many days for solve it but I am unable .

Thanks a lot for any sugget
 

TsukaYuriko

☄️
Forum Staff
Moderator
Backslashes are escape characters. The "\u" part of your path may be interpreted as the start of a hexadecimal unicode character sequence, for example.
Windows-style paths need to be either carefully escaped (by replacing single backslashes with double backslashes), or forward slashes need to be used. The latter is probably easier.

When using relative paths, you also need to be aware of what the path is relative to. Create a file with just a file name, see where it lands - that's your base path which your relative paths are relative to. If this is not the directory you want, you have to specify an absolute path. I assume you're trying to save stuff to the directory the .exe file is located in - in that case, your base path should be program_directory.


Experiment around with what path settings work with file_text_open* and _close first, just to make sure the downloading part isn't messing up things. Once you know which approach works, switch over to the downloaded file.
 

rIKmAN

Member
*REMOVED*
I wasn't shutting anyone down, I was letting them know the version numbers they posted aren't the latest version like they said they were using, but the versions they posted could easily be typos.

You should seriously think twice before you make posts, most of them are profile post spam or low effort rubbish that add nothing of value to the forum or conversation, but this one is bordering on racist.

Grow up.
 
Last edited by a moderator:

Nocturne

Friendly Tyrant
Forum Staff
Admin
Topic tidied.

@Joe Ellis :
You should seriously think twice before you make posts, most of them are profile post spam or low effort rubbish that add nothing of value to the forum or conversation, but this one is bordering on racist.
The above comment is fairly spot on and any more comments from you like the one I've removed and you'll get a warning. While I can understand that your comment was not intended as racist in any way, it was perceived as racist, so take care with what you post on the forums in the future please.
 
Last edited:
R

Rommel76

Guest
Sorry .... I disappeared due working trip ....

I apologize for my bad typo , runtime v2.2.3.344, but anyway I am still unable to get any result
I assume you're trying to save stuff to the directory the .exe file is located in - in that case, your base path should be program_directory.
In the reality yes , this is my target but really I am unable to understand how do it ...
I try with :
des = program_directory + "Test.zip" ;
but in the end the file still being saved in the appdata directory :(:(:(
the only "success I had" is using :
des = "/program_directory/test.zip"

In this case it save the file in the root of my D:\ hard disk with a file called "program_directory " with inside the file "test.zip"

But the program is installed in d:\Gametest\

Will try again tomorrow :mad::mad::mad: there must be a solution but of course I am not enough skilled

Thanx for the support and the messages of everybodies
 

TsukaYuriko

☄️
Forum Staff
Moderator
Are you testing this from within the IDE or from a compiled project? (You mentioned that it's installed, but just to make sure...)

Also, did you ever output the path generated by your code to verify that it points to the correct location?
 

Joe Ellis

Member
des = "/program_directory/test.zip" will make a directory in the hard drive base dir cus program_directory is put as a string, cus it's in inverted commas,

The other way should save it in the program directory, but if you're running it in "runner" ei. running it pressing play inside gamemaker, the program_directory is the directory that the "runner.exe" is in. and that's never useful when you're testing it from inside gamemaker.

But if the program is installed in d:\gametest\, Is the program a single executable? cus then the files extracted upon run would probably get put in a temp or local app data folder, and the program_directory might then be set to that cus it's more relevant.

If I was you, I'd make a small .cfg text file, in the "local app data" directory when the program gets installed. and in it contain the paths that the program needs, then all it has to do is simply open "setup.cfg", and then read each of the paths it needs.

Alot of programs write to the appdata folder when they install.. alot of the data I don't know what it's for, cus who can, but if you look through the folders for programs alot of them have text files which hold the directory the program is installed in. I think an exe file, is unable to know\find out where it is on the hard-drive, I'm not sure, I think they normally either have some thing where they look up the registry, or use a text file located in appdata\program_name\
 
Last edited:
R

Rommel76

Guest
Are you testing this from within the IDE or from a compiled project? (You mentioned that it's installed, but just to make sure...)

Also, did you ever output the path generated by your code to verify that it points to the correct location?
I proceed from a compiled ide everytime , the think i am unable to understand is that if I check the program_directory with a show_message (program_directory) the path is right ...

I tryed by the way in "copy and paste " the official example about http_get_file from the help .... changing the url of the download .... but anyway doesn't save the file in the folder deigned ...
 

TsukaYuriko

☄️
Forum Staff
Moderator
Sorry to ask the same question again, but are you running the project from within the IDE (using the Run or Debug option), or are you exporting the game as an executable/zip/installer and then running the exported game? "from a compiled IDE" sounds like a mixture of both. ^^'

For reference, you need the second option.

Could you share an example of the generated path output and post the exact code you used to generate it?
 
R

Rommel76

Guest
Sorry to ask the same question again, but are you running the project from within the IDE (using the Run or Debug option), or are you exporting the game as an executable/zip/installer and then running the exported game? "from a compiled IDE" sounds like a mixture of both. ^^'

For reference, you need the second option.

Could you share an example of the generated path output and post the exact code you used to generate it?
Hi
Everytime I run it or with the installer or with the executable zip , but with any trial I've done the result continue saing the file in the root of hard drive I am operating
I mean , if the program is installed or is a single executable located in d:\prova23 the file must be saved in d:\prova23 and in any case it continuosly being saved in D:\program_directory\test.zip
There isn't a way for say to the program Hey ... save it in the same directory where the software is installed ? :mad::mad::mad:

Could you share an example of the generated path output and post the exact code you used to generate it?
Sorry may you explain me better what do you mean ? I doesn't understood it
 

rIKmAN

Member
Hi
Everytime I run it or with the installer or with the executable zip , but with any trial I've done the result continue saing the file in the root of hard drive I am operating
I mean , if the program is installed or is a single executable located in d:\prova23 the file must be saved in d:\prova23 and in any case it continuosly being saved in D:\program_directory\test.zip
There isn't a way for say to the program Hey ... save it in the same directory where the software is installed ? :mad::mad::mad:



Sorry may you explain me better what do you mean ? I doesn't understood it
If you print program_directory to the screen using draw_text(), then run it from the IDE and again from a compiled exe you should see that the path changes.

I did have issues a while ago saving to the same directory as the exe and had to make a folder in the same directory as it and then save in there.

This was before we were able to turn off the sandbox though and I haven't retested since, but try doing that and see if that works.
 
R

Rommel76

Guest
If you print program_directory to the screen using draw_text(), then run it from the IDE and again from a compiled exe you should see that the path changes.

I did have issues a while ago saving to the same directory as the exe and had to make a folder in the same directory as it and then save in there.

This was before we were able to turn off the sandbox though and I haven't retested since, but try doing that and see if that works.
This is right the thing I am unable to understand , with draw_text (program_directory) the path is right as you can see by the picture , so I am expecting that program directory works in the same way for save the file in the program directory ... but no ... it still save in the root :mad::mad:
Catturatest.JPG
 

TsukaYuriko

☄️
Forum Staff
Moderator
Can you download the file to whatever location and then move it to the correct one? Not as a solution, but as a test - if that doesn't work, you lack permissions to write to your desired destination.
 
R

Rommel76

Guest
Can you download the file to whatever location and then move it to the correct one? Not as a solution, but as a test - if that doesn't work, you lack permissions to write to your desired destination.
The file everytime has been downloaded in the root of the hard drive and not in the folder where the program run , in the picture I post the program run in d:\Prova23\ but the program create a folder in D: called program_directory and inside the file downloaded.

I made other several test and I put as a destination Directory des = "\\prova23\\Test.zip" and finally the file has been downloaded in the working directory of the program ... but it work only if the directory is named "prova23" ... if you install with the gm installer and you change the folder name or the path doesnt' work ...so my question is how I can make the destination everytime the same like des = wherever the user choose to install the software ?

I feel I am missing something , but in any case why with des = "\\program_directory\\Test.zip" doesn't work ?

Thanx a lot for the support
 
R

Rommel76

Guest
I am loosing the hope... Is more than 1 month I am trying and trying to solve it without success .... Is possible it doesn't be any way out ? ... Why I. The runtime release notes they says is possible if doesn't work ?
 

TsukaYuriko

☄️
Forum Staff
Moderator
It works perfectly fine on my end.

You are using "program_directory" as a string. That won't work. You have to use it as a variable and concatenate it with the rest of your path - as in, program_directory + "your path".

What was the result when you downloaded the file to the default location and then moved it?
 
R

Rommel76

Guest
It works perfectly fine on my end.

You are using "program_directory" as a string. That won't work. You have to use it as a variable and concatenate it with the rest of your path - as in, program_directory + "your path".

In this case I already done this :

if !directory_exists(program_directory + "Games")
{
directory_create(program_directory + "Games");
}


file = "https:xxxxxxxxxxxxxxxxxxxxx.zip" // link al file
des = program_directory + "Games\\Test_download.zip"
download = http_get_file(file,des);
size = 0 ;
progress = 0 ;
image_speed = 0

And if I run using F5 it works proprely ... it download the file in the right directory and subdirectroy , if I compile it same as a zip or with the installer it doesn't work ..... Why ?



What was the result when you downloaded the file to the default location and then moved it?
Sorry for my ignorance , but what you mean with " then move it " you mean with a command ?

At this link I shared the project

https://drive.google.com/open?id=1N7Rz8ILzSnl9EPTeY1EwQnVMrI6JNv19

If somebody can check and say to me where I am wrong I will apreciate it a lot .... I am really loosing the hope to solve it :-( but I don't want give up even if I am a donkey :-( :-(
 
R

Rommel76

Guest
Cannot , in the built as I wrote even if show the message file download works in the end if I try search the file in the hard disk I am unable to find it anywhere .

But , why it works proprely if I launch it with F5 but doesn't work with installer package or zip ?
 

FrostyCat

Redemption Seeker
Save in working_directory, not program_directory. Even if the sandbox is off, program_directory could still be unwritable on Windows if you install in a place covered by UAC virtualization. It'll look like the write succeeded, but nothing shows up there.
 
R

Rommel76

Guest
Save in working_directory, not program_directory. Even if the sandbox is off, program_directory could still be unwritable on Windows if you install in a place covered by UAC virtualization. It'll look like the write succeeded, but nothing shows up there.
I tried but the result is the same and with working_directory instead program_directory it doesn't work also with F5 test/run
 

FrostyCat

Redemption Seeker
I tried but the result is the same and with working_directory instead program_directory it doesn't work also with F5 test/run
I ran your sample project with working_directory and found the download in %appdata%\Http_dwl as expected. So what's the issue?
 
R

Rommel76

Guest
I ran your sample project with working_directory and found the download in %appdata%\Http_dwl as expected. So what's the issue?
Ok sorry , my fault for that you are right , I found it but the issue is still the same , I have to download the file in a specified directory , the directory must created in the working directory and the file must be downloaded there not in the app data or in other folders , otherwise it will be useless for the second step I have to do ...
 

TsukaYuriko

☄️
Forum Staff
Moderator
If absolutely none of the instructions in this topic work for you, chances are that you don't have permissions to write to the location you're trying to write to, or you somehow don't have the sandbox bypass active. This would be on the operating system level and would have nothing to do with GameMaker Studio. If it doesn't work for you, it doesn't mean that it doesn't work in general - merely that something, whatever it may be, is wrong with your setup.
 
R

Rommel76

Guest
If absolutely none of the instructions in this topic work for you, chances are that you don't have permissions to write to the location you're trying to write to, or you somehow don't have the sandbox bypass active. This would be on the operating system level and would have nothing to do with GameMaker Studio. If it doesn't work for you, it doesn't mean that it doesn't work in general - merely that something, whatever it may be, is wrong with your setup.
Sorry but I tested it in 3 different computer with windows 7 and windows 10 , am I the only one that have 3 computer set up in the wrong way ? , generally I post a reply after few days because I am spending a lot of times looking for a solution ... but also in the web there is no documentation above ...

I tryed moove the installation in c: , D: , programx86 , program files , everywhere ... and doesn't work at all , I disable the sandbox and do everything as for guides ... but sorry .... are you telling me that the project I shared on your computer works proprely ? because the %appdata% directory isn't the target I need
 
Top