wxImage::LoadFile and wxFile::Exists default dir

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
mael15
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 539
Joined: Fri May 22, 2009 8:52 am
Location: Bremen, Germany

wxImage::LoadFile and wxFile::Exists default dir

Post by mael15 »

on my windows computer, wxImage::LoadFile and wxFile::Exists find and load a file only by its filename, without a path. i cannot find this file anywhere, neither in my .exe dir nor the user´s documents folder. also, the windows file file search cannot find it, so where is it? what is the default directory for these functions on windows?

the "found" file name is "von Bild eins.jpg_back.png" and there is a "eins.jpg", so do these function crop the file name so it works?
User avatar
doublemax@work
Super wx Problem Solver
Super wx Problem Solver
Posts: 474
Joined: Wed Jul 29, 2020 6:06 pm
Location: NRW, Germany

Re: wxImage::LoadFile and wxFile::Exists default dir

Post by doublemax@work »

what is the default directory for these functions on windows?
It's the "current working directory", which is the program directory at start, but it can change through user actions. That's why it's never a good idea to depend on it when loading anything. Always build an absolute path, e.g. based on wxStandardPaths
the "found" file name is "von Bild eins.jpg_back.png" and there is a "eins.jpg", so do these function crop the file name so it works?
I doubt that, i'd guess any pathnames are passed through to the OS file system functions unchanged . There must be something else going on.
Post Reply