This commit is contained in:
zeromus 2010-10-27 04:44:26 +00:00
parent 3cc1963129
commit 8b01f9eb3d
8 changed files with 90 additions and 51 deletions

View File

@ -23,7 +23,7 @@ libdesmume_a_SOURCES = \
firmware.cpp firmware.h GPU.cpp GPU.h \
GPU_osd.h \
mem.h mc.cpp mc.h \
path.h \
path.cpp path.h \
readwrite.cpp readwrite.h \
wifi.cpp wifi.h \
mic.h \

View File

@ -1,21 +1,18 @@
/* Copyright (C) 2008 Guillaume Duhamel
Copyright (C) 2009-2010 DeSmuME team
This file is part of DeSmuME
DeSmuME is free software; you can redistribute it and/or modify
This file 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
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
DeSmuME is distributed in the hope that it will be useful,
This file 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 DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include "debug.h"

59
desmume/src/path.cpp Normal file
View File

@ -0,0 +1,59 @@
/* Copyright 2009-2010 DeSmuME team
This file 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 file 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 the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include "types.h"
#include "path.h"
#include <stdio.h>
//-----------------------------------
#ifdef _WINDOWS
void FCEUD_MakePathDirs(const char *fname)
{
char path[MAX_PATH];
const char* div = fname;
do
{
const char* fptr = strchr(div, '\\');
if(!fptr)
{
fptr = strchr(div, '/');
}
if(!fptr)
{
break;
}
int off = fptr - fname;
strncpy(path, fname, off);
path[off] = '\0';
mkdir(path);
div = fptr + 1;
while(div[0] == '\\' || div[0] == '/')
{
div++;
}
} while(1);
}
#endif
//------------------------------

View File

@ -21,7 +21,11 @@
#endif
#if defined(_WINDOWS)
#include <winsock2.h>
#include <windows.h>
#include <direct.h>
#include "winutil.h"
#include "common.h"
#if !defined(WXPORT)
#include "resource.h"
#else
@ -34,6 +38,10 @@
#include "time.h"
#include "utils/xstring.h"
#ifdef _WINDOWS
void FCEUD_MakePathDirs(const char *fname);
#endif
//-----------------------------------
//This is taken from mono Path.cs
static const char InvalidPathChars[] = {
@ -70,43 +78,6 @@ public:
(!dirEqualsVolume && path.size() > 1 && path [1] == VolumeSeparatorChar));
}
};
//-----------------------------------
#if defined(_WINDOWS)
static void FCEUD_MakePathDirs(const char *fname)
{
char path[MAX_PATH];
const char* div = fname;
do
{
const char* fptr = strchr(div, '\\');
if(!fptr)
{
fptr = strchr(div, '/');
}
if(!fptr)
{
break;
}
int off = fptr - fname;
strncpy(path, fname, off);
path[off] = '\0';
mkdir(path);
div = fptr + 1;
while(div[0] == '\\' || div[0] == '/')
{
div++;
}
} while(1);
}
#endif
//------------------------------
class PathInfo
{

View File

@ -2156,6 +2156,10 @@
RelativePath="..\OGLRender.h"
>
</File>
<File
RelativePath="..\path.cpp"
>
</File>
<File
RelativePath="..\path.h"
>

View File

@ -858,6 +858,10 @@
RelativePath="..\OGLRender.h"
>
</File>
<File
RelativePath="..\path.cpp"
>
</File>
<File
RelativePath="..\path.h"
>

View File

@ -462,6 +462,7 @@
<ClCompile Include="..\movie.cpp" />
<ClCompile Include="..\NDSSystem.cpp" />
<ClCompile Include="..\OGLRender.cpp" />
<ClCompile Include="..\path.cpp" />
<ClCompile Include="..\rasterize.cpp" />
<ClCompile Include="..\readwrite.cpp" />
<ClCompile Include="..\render3D.cpp" />

View File

@ -435,6 +435,9 @@
<ClCompile Include="..\utils\libfat\lock.cpp">
<Filter>Core\utils\libfat</Filter>
</ClCompile>
<ClCompile Include="..\path.cpp">
<Filter>Core</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\addons.h">