Legacy GM %USERPROFILE% is not working?[SOLVED]

alper41

Member
Hello again, I'm facing a brand new problem, I want to add a steam cloud feature to my game, but %USERPROFILE% doesn't work, it also works when I type the user name of my computer instead of %USERPROFILE%

Code:
if steam_is_cloud_enabled_for_app()
steam_file_write_file("ayarlar.ini","C:\Users\alper\AppData\Local\Alpha___Beta\ayarlar.ini")
this code works but only works on my own computer

Code:
if steam_is_cloud_enabled_for_app()
steam_file_write_file("ayarlar.ini","C:\Users\%USERPROFILE%\AppData\Local\Alpha___Beta\ayarlar.ini")
not working
 
Last edited:

alper41

Member
Help us help you by providing code that exhibit the problem.
I understand

Code:
if steam_is_cloud_enabled_for_app()
steam_file_write_file("ayarlar.ini","C:\Users\alper\AppData\Local\Alpha___Beta\ayarlar.ini")
this code works but only works on my own computer

Code:
if steam_is_cloud_enabled_for_app()
steam_file_write_file("ayarlar.ini","C:\Users\%USERPROFILE%\AppData\Local\Alpha___Beta\ayarlar.ini")
not working
 

Vishnya

Member
I understand

Code:
if steam_is_cloud_enabled_for_app()
steam_file_write_file("ayarlar.ini","C:\Users\alper\AppData\Local\Alpha___Beta\ayarlar.ini")
this code works but only works on my own computer

Code:
if steam_is_cloud_enabled_for_app()
steam_file_write_file("ayarlar.ini","C:\Users\%USERPROFILE%\AppData\Local\Alpha___Beta\ayarlar.ini")
not working
I think you should write
Code:
"%userprofile%\..."
instead
Code:
"C:\Users\%userprofile%\..."
 

chamaeleon

Member
Not being at my computer with GMS right now but I'm not sure why %userprofile% would be expanded. Maybe it's supposed to by that function, but I would rather expect you need to use environtment_get_variable and concatenate strings to get the full path using its value.
 

alper41

Member
Not being at my computer with GMS right now but I'm not sure why %userprofile% would be expanded. Maybe it's supposed to by that function, but I would rather expect you need to use environtment_get_variable and concatenate strings to get the full path using its value.
Code:
a = environment_get_variable("USERPROFILE\");

if steam_is_cloud_enabled_for_app()
steam_file_write_file("ayarlar.ini",a+"AppData\Local\Alpha___Beta\ayarlar.ini")
I tried this way but it didn't work

Code:
Complie Message:

Failed to find local file: AppData\Local\Alpha___Beta\ayarlar.ini
 
Last edited:

chamaeleon

Member
Code:
a = environment_get_variable("USERPROFILE\");

if steam_is_cloud_enabled_for_app()
steam_file_write_file("ayarlar.ini",a+"AppData\Local\Alpha___Beta\ayarlar.ini")
I tried this way but it didn't work

Code:
Complie Message:

Failed to find local file: AppData\Local\Alpha___Beta\ayarlar.ini
You shouldn't have \ in the environment_get_variable() call, the name of it does not include a backslash. Maybe you can try
Code:
var userprofile = environment_get_variable("USERPROFILE");
show_debug_message("USERPROFILE = " + userprofile);
if (steam_is_cloud_enabled_for_app()) {
    steam_file_write_file("ayarlar.ini", userprofile + "\AppData\Local\Alpha___Beta\ayarlar.ini");
}
 

alper41

Member
You shouldn't have \ in the environment_get_variable() call, the name of it does not include a backslash. Maybe you can try
Code:
var userprofile = environment_get_variable("USERPROFILE");
show_debug_message("USERPROFILE = " + userprofile);
if (steam_is_cloud_enabled_for_app()) {
    steam_file_write_file("ayarlar.ini", userprofile + "\AppData\Local\Alpha___Beta\ayarlar.ini");
}
Thanks thanks, worked
 
Top