Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » odd behavior with SaveFile
odd behavior with SaveFile [message #59674] Wed, 01 March 2023 11:34 Go to next message
Mountacir is currently offline  Mountacir
Messages: 49
Registered: November 2021
Member
Hi,

I'm having an issue with saving .cfg file that has Windows path in it.
If i try to save it in the same folder as the .exe with SaveFile("config.cfg", cfg) it saves it in a random "This PC" folder!

FileSelNative fs;
fs.Type("jpg & png Images","*.jpg;*.jpeg;*.png;*.png");
if(!fs.ExecuteOpen()) return;

String cfg;
cfg << "PATH=" << ~fs << "\n";

//This works
if(!SaveFile("C:\\Users\\ATT\\Documents\\upp_16660\\out\\MyApps\\CLANGx64.Debug.Debug_Full.Gui\\config1.cfg", cfg))
	LOG("Error saving configuration!");

//But this will save it in my Downloads or Pictures or Desktop.. folder
if(!SaveFile("config2.cfg", cfg))
	LOG("Error saving configuration!");
Re: odd behavior with SaveFile [message #59688 is a reply to message #59674] Sat, 04 March 2023 13:26 Go to previous messageGo to next message
Oblivion is currently offline  Oblivion
Messages: 1094
Registered: August 2007
Senior Contributor
Hi,

You can use Upp::GetExeFolder() function to get the directory of the exe file.

Best regards,
Oblivion


[Updated on: Sat, 04 March 2023 13:54]

Report message to a moderator

Re: odd behavior with SaveFile [message #59689 is a reply to message #59674] Sun, 05 March 2023 11:12 Go to previous message
Mountacir is currently offline  Mountacir
Messages: 49
Registered: November 2021
Member
Hi,

GetExeFolder() works like a charm.

Thank you very much Oblivion.
Previous Topic: AssertMoveable fails to work?
Next Topic: Latest leap second missing from GetLeapSeconds()
Goto Forum:
  


Current Time: Mon Jun 17 09:57:12 CEST 2024

Total time taken to generate the page: 0.01521 seconds