Ejemplo n.º 1
0
static void determineGlobalPaths(application_t* app)
{
    assert(app);

    // By default, make sure the working path is the home folder.
    de::App::setCurrentWorkPath(de::App::app().nativeHomePath());

#ifndef MACOSX
    if(getenv("HOME"))
    {
        filename_t homePath;
        directory_t* temp;
        dd_snprintf(homePath, FILENAME_T_MAXLEN, "%s/%s/runtime/", getenv("HOME"),
                    DENG2_APP->unixHomeFolderName().toLatin1().constData());
        temp = Dir_New(homePath);
        Dir_mkpath(Dir_Path(temp));
        app->usingHomeDir = Dir_SetCurrent(Dir_Path(temp));
        if(app->usingHomeDir)
        {
            DD_SetRuntimePath(Dir_Path(temp));
        }
        Dir_Delete(temp);
    }
#endif

    // The -userdir option sets the working directory.
    if(CommandLine_CheckWith("-userdir", 1))
    {
        filename_t runtimePath;
        directory_t* temp;

        strncpy(runtimePath, CommandLine_NextAsPath(), FILENAME_T_MAXLEN);
        Dir_CleanPath(runtimePath, FILENAME_T_MAXLEN);
        // Ensure the path is closed with a directory separator.
        F_AppendMissingSlashCString(runtimePath, FILENAME_T_MAXLEN);

        temp = Dir_New(runtimePath);
        app->usingUserDir = Dir_SetCurrent(Dir_Path(temp));
        if(app->usingUserDir)
        {
            DD_SetRuntimePath(Dir_Path(temp));
#ifndef MACOSX
            app->usingHomeDir = false;
#endif
        }
        Dir_Delete(temp);
    }

#ifndef MACOSX
    if(!app->usingHomeDir && !app->usingUserDir)
#else
    if(!app->usingUserDir)
#endif
    {
        // The current working directory is the runtime dir.
        directory_t* temp = Dir_NewFromCWD();
        DD_SetRuntimePath(Dir_Path(temp));
        Dir_Delete(temp);
    }

    // libcore has determined the native base path, so let FS1 know about it.
    DD_SetBasePath(DENG2_APP->nativeBasePath().toUtf8());
}
Ejemplo n.º 2
0
int tfs_removeDir(char *dirName) {
    if(tfs_name_check(dirName) < 0) {
        return BAD_FILENAME;
    }
    return Dir_Delete(disk_num, dirName);
}