SFML community forums

Help => General => Topic started by: The Dab on January 05, 2018, 11:37:40 pm

Title: Font will not load from file while injected
Post by: The Dab on January 05, 2018, 11:37:40 pm
" font.loadFromFile(filename.ttf); " returns false. The reason is because I am using working in a dynamic link library (DLL) instead of a console application. I put the font file in the project directory as well as in the process directory of the application I am injecting into. I put the exact code in a console application and it worked. I am using visual studio 2017, is there any way I can link it in project properties, or is there a function I am missing?
Title: Re: Font will not load from file while injected
Post by: Ceylo on January 05, 2018, 11:51:19 pm
You should check what is the current working directory at the time of loading the font, it’s not necessarily the directory of your executable.
Title: Re: Font will not load from file while injected
Post by: The Dab on January 05, 2018, 11:56:09 pm
It is, I right click on the solution name, then "open folder in file explorer", it brings me right to the folder where my font is located.
Title: Re: Font will not load from file while injected
Post by: Ceylo on January 06, 2018, 12:51:51 am
https://en.m.wikipedia.org/wiki/Working_directory
Title: Re: Font will not load from file while injected
Post by: dabbertorres on January 06, 2018, 11:20:40 pm
And for reference, Visual Studio's default working directory when executing is the project directory

(the setting is <right-click on project> -> Properties -> Configuration Properties -> Debugging -> Working Directory)