Added missing Win32 filesystem stuff.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@467 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-06-05 22:20:49 +00:00
parent a934f8fc98
commit 02b1db5c0e
2 changed files with 30 additions and 12 deletions

View File

@ -13,12 +13,14 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: FSNodeWin32.cxx,v 1.3 2005-05-29 18:54:28 stephena Exp $
// $Id: FSNodeWin32.cxx,v 1.4 2005-06-05 22:20:49 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
//============================================================================
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
@ -248,28 +250,38 @@ AbstractFilesystemNode* WindowsFilesystemNode::parent() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool AbstractFilesystemNode::fileExists(const string& path)
{
// FIXME
return true;
WIN32_FILE_ATTRIBUTE_DATA attr;
BOOL b = GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &attr);
return ((b != 0) && !(attr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool AbstractFilesystemNode::dirExists(const string& path)
{
// FIXME
return true;
WIN32_FILE_ATTRIBUTE_DATA attr;
BOOL b = GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &attr);
return ((b != 0) && (attr.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool AbstractFilesystemNode::makeDir(const string& path)
{
_mkdir(path.c_str());
return true;
return CreateDirectory(path.c_str(), NULL) != 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string AbstractFilesystemNode::modTime(const string& path)
{
// FIXME - use GetFileAttributesEx
WIN32_FILE_ATTRIBUTE_DATA attr;
BOOL b = GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &attr);
if(b == 0)
return "";
ostringstream buf;
buf << attr.ftLastWriteTime.dwHighDateTime << attr.ftLastWriteTime.dwLowDateTime;
return buf.str();
}

View File

@ -209,6 +209,9 @@ opengl32.lib"
<File
RelativePath="..\..\gui\Debugger.cxx">
</File>
<File
RelativePath="..\..\gui\DebuggerDialog.cxx">
</File>
<File
RelativePath="..\..\emucore\Deserializer.cxx">
</File>
@ -475,6 +478,9 @@ opengl32.lib"
<File
RelativePath="..\..\gui\Debugger.hxx">
</File>
<File
RelativePath="..\..\gui\DebuggerDialog.hxx">
</File>
<File
RelativePath="..\..\emucore\Deserializer.hxx">
</File>