On Thursday, 16 June 2016 at 10:02:01 UTC, TheDGuy wrote:
On Thursday, 16 June 2016 at 09:27:38 UTC, Basile B. wrote:
FOrget any previous comment and in your program use the first
argument of the command line to detect your resources, this
will solve your problem. For the execution click compile and
run or just run.
Okay:
void main(string[] args){
writeln(args[0]);
Main.init(args);
auto win = new Window(250,250,"Tutorial");
Main.run();
}
This gives me the location of the .exe. What should i do with
it now?
On Win and Nux, the first argument of the command line is
always the program filename so you just have to get the
directory for this string and you'll get what you expected
with cwd.
I don't care about cwd i want to get rid of the error!
from args[0] you can get the base bath and since your css is
relative to the base path:
string cssPath = "test.css";
CssProvider provider = new CssProvider();
provider.loadFromPath(cssPath);
add something like
import std.path;
basePath = args[0].dirName;
string cssPath = basePath ~ "\" ~ "test.css";
and you can remove all the stuff in the Run options.