Esempio n. 1
0
void MainDropFiles(HWND hWnd, HDROP hDrop)
{
    char Command[MAX_PATH], File[MAX_PATH];

    DragQueryFile(hDrop, 0, File, MAX_PATH);
    DragFinish(hDrop);

    //Move the current directory
    //Happens automatically if they use the open dialog
    //If they directly invoke :load then not necessary
    SetWorkingDir(File);

    wsprintf(Command, ":load %s", ExpandFileName((String)File));
    FireCommand(Command);
}
Esempio n. 2
0
bool Engine::RelocateWorkingDir(void)
{
    std::string procdir = GetProgramDir();
    if(procdir.length())
    {
        if(SetWorkingDir(procdir))
        {
            logdetail("Working directory successfully changed to program directory:");
            logdetail(" '%s'", procdir.c_str());
            return true;
        }
        else
        {
            logerror("Unable to change working directory to program directory:");
            logerror(" '%s'", procdir.c_str());
        }
    }
    else
    {
        logerror("WARNING: Unable to detect program directory! Be sure to run this from the correct path or set the working dir manually, "
            "otherwise the engine may not find its data and will be unable to start up!");
    }
    return false;
}