User forums > Help

Indefinite Paths in Compiler Installation Directory

<< < (2/2)

MortenMacFly:
...do you know that you can also setup a path like "C:\$USERNAME" which is replaced with the environment variable %USERNAME% under Windows (and linux)?

Thus you can setup the path to the compiler like C:\Docume~1\$USERNAME\Desktop\CodeBlocks

???

Edit: BTW: You should avoid having spaces in the path to the compiler...

BordRider:

--- Quote from: MortenMacFly on July 19, 2006, 10:16:27 pm ---Edit: BTW: You should avoid having spaces in the path to the compiler...

--- End quote ---

I learned THAT the hard way..I tried the same thing (putting the compiler in the codeblocks dir in "program files") and almost died...

We'll chock that one up to my ignorance though :P

Game_Ender:
If you are using Boost.Filesystem this code will do it for you:

--- Code: ---#include <iostream>
using namespace std;

#include <boost/filesystem/operations.hpp>
namespace bfs = boost::filesystem;

int main(int argc, char** argv)
{
    cout << "My full path: " << bfs::current_path().string() << endl;
}

--- End code ---

Its tested and it works like a charm.  Gotta love boost.

Maybe we should check there implementation? Current_path uses getcwd on any Unix like platform.   On Windows it uses GetCurrentDirectory.  Or since we are using wxWidgets we can use wxGetCwd in wx/filefn.h.  Which I just tested and it works exactly the same.

Both give you the full path from root.

EDIT:   BinReloc listed above is cool because it will tell you where libraries and such are too.

Navigation

[0] Message Index

[*] Previous page

Go to full version