Changeset 1476 for trunk/gsdl/lib
- Timestamp:
- 2000-08-31T08:57:08+12:00 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/lib/fileutil.cpp
r1456 r1476 238 238 #endif 239 239 240 // I'm sure there's a better way to do this - for now I don't have241 // time to find it though242 240 // returns true if things look like they happened ok 243 241 bool file_copy (const text_t &fromfile, const text_t &tofile) { … … 246 244 char *tofilec = tofile.getcstr(); 247 245 bool fail = false; 246 247 #ifdef __WIN32__ 248 if (CopyFile (fromfilec, tofilec, FALSE) == 0) fail = true; 249 250 #else 251 252 // I'm sure there's a better way to do this - for now I don't have 253 // time to find it though 248 254 ifstream from (fromfilec); 249 255 if (!from) { … … 265 271 } 266 272 } 273 274 #endif 275 267 276 delete fromfilec; 268 277 delete tofilec; … … 270 279 return true; 271 280 } 272 273 /*274 275 #ifdef __WIN32__276 char *fromfilec = fromfile.getcstr();277 char *tofilec = tofile.getcstr();278 CopyFile (fromfilec, tofilec, FALSE);279 delete fromfilec;280 delete tofilec;281 282 #else283 text_t cp_cmd = "cp " + fromfile + " " + tofile;284 char *cp_cmdc = cp_cmd.getcstr();285 system (cp_cmdc);286 delete cp_cmdc;287 288 #endif289 */290 281 291 282 // returns the last line (or last 256 characters) … … 323 314 } 324 315 325 // probably need windows version of this 316 #ifdef __WIN32__ 317 318 #include <direct.h> 319 // returns true if directory was created successfully 320 bool mk_dir (const text_t &dirname) { 321 char *dirnamec = dirname.getcstr(); 322 int rv = _mkdir (dirnamec); 323 delete dirnamec; 324 if (rv == 0) return true; 325 return false; 326 } 327 328 #else 329 326 330 #include <sys/stat.h> 327 331 #include <sys/types.h> 328 332 #include <fcntl.h> 329 333 #include <unistd.h> 330 331 334 // returns true if directory was created successfully 332 335 bool mk_dir (const text_t &dirname) { … … 339 342 } 340 343 344 #endif
Note:
See TracChangeset
for help on using the changeset viewer.