root/bdm/osutils.cpp @ 93

Revision 93, 0.9 kB (checked in by smidl, 16 years ago)

oprava loggeru

  • Property svn:eol-style set to native
Line 
1//
2// C++ Implementation: osutils
3//
4// Description:
5//
6//
7// Author: smidl <smidl@utia.cas.cz>, (C) 2008
8//
9// Copyright: See COPYING file that comes with this distribution
10//
11//
12
13#include "osutils.h"
14#include <iostream>
15
16#ifdef WIN32
17#include <direct.h>
18#else
19#include <sys/types.h>
20#include <sys/stat.h>
21#endif
22
23#include <fcntl.h>
24#include <errno.h>
25
26
27void get_fname ( char* filename, string &dirname, string &f ) {
28#ifdef WIN32
29        sprintf ( filename,"%s\\%s",dirname.c_str(),f.c_str() );
30#else
31        sprintf ( filename,"%s/%s",dirname.c_str() ,f.c_str() );
32#endif
33}
34
35void makedir(string &dirname, bool rewrite){
36#ifdef WIN32
37   if (mkdir(dirname.c_str()) == -1)   // Create the directory
38#else
39   if (mkdir(dirname.c_str(), 00755) == -1)   // Create the directory
40#endif
41{
42        if ((rewrite) && ( errno==EEXIST ) ) it_warning ( "rewriting directory" );
43                else it_error ( "dirfilelog:: cannot create directory" );
44   }
45}
Note: See TracBrowser for help on using the browser.