|
|
|
|
|
|
||
|
/****************************************************************************/ /**
**/ /** Copyright
(c) 2005 Diodia Software (http://www.diodia.com/) **/ /**
**/ /** Use in any
form with or without modification for commercial and non- **/ /** commercial
purposes is permitted. **/ /**
**/ /****************************************************************************/ #include "stdafx.h" #include "io.h" #include "direct.h"
#include "Helper.h"
static int CreatePath2(char *Path);
/****************************************************************************/ /* /* DESCRIPTION : Create directories in path on local file system. /* /* RETURN VALUE: true - if OK /* false - if error /* /****************************************************************************/ bool CreatePath(const char *Path) { char *Path2; int Res;
Path2 = strdup(Path); Res = CreatePath2(Path2); free(Path2);
switch (Res) { case 0: /* error */ return false; case 1: /* directory exists */ break; case 2: /* directory doesn't exist */ if (mkdir(Path) != 0) return false; break; }
return true; }
/****************************************************************************/ /* /* DESCRIPTION : Create directories in path on local file system, except last /* directory in path. /* /* Note: Overwrites parameter Path. /* /* RETURN VALUE: 2 - if last directory in path doesn't exist /* 1 - if last directory in path exist /* 0 - if error /* /****************************************************************************/ static int CreatePath2(char *Path) { int Len; char *Ptr1; char *Ptr2;
if (access(Path, 00) == 0) return 1;
Len = (int) strlen(Path) - 1; while (Len >= 0 && (Path[Len] == '\\' || Path[Len] == '/')) Path[Len--] = '\0';
Ptr1 = strrchr(Path, '\\'); Ptr2 = strrchr(Path, '/');
if (Ptr1 && (!Ptr2 || Ptr2 < Ptr1)) *Ptr1 =
'\0'; else if (Ptr2
&& (!Ptr1 || Ptr1 < Ptr2)) *Ptr2 = '\0'; else return 0;
if (!CreatePath(Path)) return 0;
return 2; } |
Source Files Commands.cpp Context.cpp CreatePath.cpp DateParser.cpp DlgEditFeedC.cpp DlgManageFeedsC.cpp Hook.cpp Iso8601.cpp MsXmlMisc.cpp MsXmlSelect.cpp RegistryNotify.cpp RegistryUtil.cpp RSS.cpp RSS.def RSS.idl RssAction.cpp RssDownloader.cpp RssFeed.cpp RssHelpers.cpp RssInit.cpp RssItem.cpp RssMultiFeed.cpp RssTimer.cpp RssXml.cpp StdAfx.cpp Header Files Commands.h ContextC.h DateParser.h DlgEditFeedC.h DlgManageFeedsC.h Helper.h HookC.h RegistryNotify.h RegistryNotifyC.h Resource.h RssDownloaderC.h RssFeedC.h RssHelpers.h RssItemC.h RssMultiFeedC.h StdAfx.h ThreadObject.h XmlHelpers.h Resource Files about.htm DiodiaLogoSmall.gif logo.bmp manifest.xml read.bmp RSS.rc RSS.rgs ToolBandLayout.xml |
|
|
© 2002-2008 Diodia Software |
||