Category : File Managers
Archive   : UFIND402.ZIP
Filename : ENSURE.C

 
Output of file : ENSURE.C contained in archive : UFIND402.ZIP
#include
#include
#ifdef __TURBOC__
#include
#else
#ifdef __POWERC__
#include
#else
#ifdef M_I86
#include
#endif
#endif
#endif
#include

#include "queue.h"
#include "ufind.h"

/**************************************************************************
* EnsureExists - Ensure that a given pathname exists. If any directory
* in the path does NOT exist, EnsureExists will create it
* with no warning.
*************************************************************************/
void
EnsureExists (char *Path) {
char *Ptr;
int i;
struct DIR_BLK DirBlk;


if (!FIND_FIRST(Path, &DirBlk, DIREC_)
&& (DirBlk.DIR_ATTR & DIREC_) != 0) return;
Ptr = Path;
while ( (i = strcspn(Ptr, "/\\")), Ptr[i] != '\0') {
if ( (Ptr != Path) || (i >= 3) ) {
Ptr[i] = '\0';
EnsureExists(Path);
Ptr[i] = '\\';
}
Ptr += ++i;
}
mkdir(Path);
}




  3 Responses to “Category : File Managers
Archive   : UFIND402.ZIP
Filename : ENSURE.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/