Skip to content

Commit

Permalink
Added a todo about rewriting directory_t with libdeng2
Browse files Browse the repository at this point in the history
The native directory manipulations should be rewritten so that
libdeng2 (App, NativePath) and Qt are used.

The drive letter is only meaningful on Windows (added #ifdef).
  • Loading branch information
skyjake committed Dec 11, 2012
1 parent be94377 commit 1f811f5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
2 changes: 2 additions & 0 deletions doomsday/engine/include/filesys/sys_direc.h
Expand Up @@ -36,7 +36,9 @@ extern "C" {
#endif

typedef struct directory_s {
#if defined(WIN32)
int drive;
#endif
filename_t path;
} directory_t;

Expand Down
38 changes: 20 additions & 18 deletions doomsday/engine/src/filesys/sys_direc.c
@@ -1,25 +1,23 @@
/**\file sys_direc.c
*\section License
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
/** @file sys_direc.c Native file system directories.
* @ingroup system
*
*\author Copyright © 2003-2012 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2007-2012 Daniel Swanson <danij@dengine.net>
* @todo Rewrite using libdeng2's NativePath (and Qt).
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* @authors Copyright © 2003-2012 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2007-2012 Daniel Swanson <danij@dengine.net>
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
* <small>This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. This program is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details. You should have received a copy of the GNU
* General Public License along with this program; if not, see:
* http://www.gnu.org/licenses</small>
*/

#if defined(WIN32)
Expand Down Expand Up @@ -74,7 +72,9 @@ directory_t* Dir_NewFromCWD(void)
lastIndex = strlen(cwd);
lastIndex = MIN_OF(lastIndex, FILENAME_T_LASTINDEX);

#if defined(WIN32)
dir->drive = _getdrive();
#endif
memcpy(dir->path, cwd, lastIndex);
dir->path[lastIndex] = '\0';
free(cwd);
Expand Down Expand Up @@ -103,8 +103,10 @@ void Dir_Delete(directory_t* dir)
boolean Dir_IsEqual(directory_t* a, directory_t* b)
{
if(a == b) return true;
#if defined(WIN32)
if(a->drive != b->drive)
return false;
#endif
return !stricmp(a->path, b->path);
}

Expand Down

0 comments on commit 1f811f5

Please sign in to comment.