00001
00002 #include "file.H"
00003
00004
00005
00006
00007 bool rename_(Cstr_ptr &old_name, Cstr_ptr &new_name)
00008 {
00009 int ret;
00010
00011 #ifdef WIN32
00012 ret = rename(**old_name, **new_name);
00013 #else
00014
00015 ret = rename(**old_name, **new_name);
00016 #endif
00017
00018 if (ret != 0)
00019 {
00020 cerr << "rename_() - ERROR!! Couldn't rename: '" << old_name << "' to: '" << new_name << "'\n";
00021 return false;
00022 }
00023 else
00024 {
00025 return true;
00026 }
00027 }
00028
00029
00030
00031
00032 bool remove_(Cstr_ptr &file)
00033 {
00034 int ret;
00035
00036 #ifdef WIN32
00037 ret = remove(**file);
00038 #else
00039
00040 ret = remove(**file);
00041 #endif
00042
00043 if (ret != 0)
00044 {
00045 cerr << "remove_() - ERROR!! Couldn't remove: '" << file << "'\n";
00046 return false;
00047 }
00048 else
00049 {
00050 return true;
00051 }
00052 }
00053
00054
00055
00056
00057 bool rmdir_(Cstr_ptr &dir)
00058 {
00059 int ret;
00060
00061 #ifdef WIN32
00062 ret = _rmdir(**dir);
00063 #else
00064
00065 ret = rmdir(**dir);
00066 #endif
00067
00068 if (ret != 0)
00069 {
00070 cerr << "rmdir_() - ERROR!! Couldn't rmdir: '" << dir << "'\n";
00071 return false;
00072 }
00073 else
00074 {
00075 return true;
00076 }
00077 }
00078
00079
00080
00081
00082 bool mkdir_(Cstr_ptr &dir)
00083 {
00084 int ret;
00085
00086 #ifdef WIN32
00087 ret = _mkdir(**dir);
00088 #else
00089
00090 ret = mkdir(**dir, S_IRUSR | S_IWUSR | S_IXUSR |
00091 S_IRGRP| S_IXGRP |
00092 S_IROTH| S_IXOTH );
00093 #endif
00094
00095 if (ret != 0)
00096 {
00097 cerr << "mkdir_() - ERROR!! Couldn't mkdir: '" << dir << "'\n";
00098 return false;
00099 }
00100 else
00101 {
00102 return true;
00103 }
00104 }
00105
00106
00107
00108
00109 bool chdir_(Cstr_ptr &new_dir)
00110 {
00111 int ret;
00112
00113 #ifdef WIN32
00114 ret = _chdir(**new_dir);
00115 #else
00116
00117 ret = chdir(**new_dir);
00118 #endif
00119
00120 if (ret != 0)
00121 {
00122 cerr << "chdir_() - ERROR!! Couldn't CHDIR to: '" << new_dir << "'\n";
00123 return false;
00124 }
00125 else
00126 {
00127 return true;
00128 }
00129 }
00130
00131 #define CWD_BUF 1024
00132
00133
00134
00135 str_ptr
00136 getcwd_()
00137 {
00138 char *ret, cwd[CWD_BUF];
00139
00140 #ifdef WIN32
00141 ret = _getcwd(cwd,CWD_BUF);
00142 #else
00143
00144 ret = getcwd(cwd,CWD_BUF);
00145 #endif
00146
00147 if (!ret)
00148 {
00149 cerr << "getcwd_() - ERROR!! Couldn't retreive CWD!\n";
00150 return NULL_STR;
00151 }
00152 else
00153 {
00154 return cwd;
00155 }
00156 }
00157