/*
-Copyright (c) 2004-2007, John Hurst
+Copyright (c) 2004-2009, John Hurst
All rights reserved.
Redistribution and use in source and binary forms, with or without
string Path_4 = ComponentsToPath(PathList_3);
string Path_5 = PathMakeAbsolute(Path_4);
+
+ fprintf(stderr, "PathMakeAbsolute in: %s\n", Path_4.c_str());
+ fprintf(stderr, "PathMakeAbsolute out: %s\n", Path_5.c_str());
+
string Path_6 = ComponentsToAbsolutePath(PathList_3);
assert(Path_3 == Path_6);
assert(PathsAreEquivalent(Path_3, Path_6));
assert(PathSetExtension("foo.bar", "") == "foo");
assert(PathSetExtension(Path_3, "xml") == "baz.xml");
+ string Path_7 = "//tmp///////fooo";
+
+ PathCompList_t PathList_7;
+ PathToComponents(Path_7, PathList_7);
+ for ( PathCompList_t::const_iterator i = PathList_7.begin(); i != PathList_7.end(); i++ )
+ fprintf(stderr, "xx: \"%s\"\n", i->c_str());
+ assert(PathsAreEquivalent(PathMakeLocal(PathMakeCanonical(Path_7), "/tmp"), "fooo"));
+
+ string Path_8 = "tmp/foo/bar/ack";
+ CreateDirectoriesInPath(Path_8);
+ assert(PathExists(Path_8));
+ DeletePath(Path_8);
+ assert(!PathExists(Path_8));
+
PathList_t InList, OutList;
InList.push_back("tmp");
InList.push_back("Darwin");
FindInPaths(PathMatchAny(), InList, OutList);
PathList_t::iterator pi;
- for ( pi = OutList.begin(); pi != OutList.end(); pi++ )
- cerr << *pi << endl;
+ if ( false )
+ {
+ for ( pi = OutList.begin(); pi != OutList.end(); pi++ )
+ cerr << *pi << endl;
+ }
+ else
+ {
+ cerr << OutList.size() << ( ( OutList.size() == 1 ) ? " file" : " files" ) << endl;
+ }
cerr << "----------------------------------" << endl;
OutList.clear();
cerr << "----------------------------------" << endl;
+ fsize_t free_space, total_space;
+ FreeSpaceForPath("/", free_space, total_space);
+ cerr << "Free space: " << free_space << endl;
+ cerr << "Total space: " << total_space << endl;
+ cerr << "Used space: " << ( (total_space - free_space ) / float(total_space) ) << endl;
+
cerr << "OK" << endl;
return 0;