SFML community forums

Help => General => Topic started by: BarryLarry17Jr on July 26, 2020, 03:41:07 pm

Title: How do I load relatively
Post by: BarryLarry17Jr on July 26, 2020, 03:41:07 pm
Right now i am loading a texture from this directory:

arrow.loadFromFile("/Users/oliverswan/Desktop/SFML/Coin\ Flip/Coin\ Flip/arrow.png");

But I want to load from my project folder which is the first Coin Flip Folder. Help!
Title: Re: How do I load relatively
Post by: Paul on July 27, 2020, 01:00:08 pm
Nice chaos. Don't use system paths and don't put files on your desktop.

Create folder on C:\ like "C:\Dev", put all your projects there, then put your assets (graphics, audio..) into specific project folder and use relative path, which will be just name of file or something like "Textures/texture.png" if you create extra folders.
Title: Re: How do I load relatively
Post by: Hapax on July 28, 2020, 12:00:53 am
If the working directory is (definitely) the first coin flip folder, you can use the rest of the path as a relative one: "Coin Flip/arrow.png". If the working directory is the second coin flip folder, the relative path would just be the file: "arrow.png".