Code Monkey home page Code Monkey logo

filesystem's Issues

Unable to build the library on linux environment (MAX_PATH is not declared)

I try to build the library on POSIX environment, where the "MAX_PATH" constant is not defined

make
Scanning dependencies of target path_demo
[ 50%] Building CXX object CMakeFiles/path_demo.dir/path_demo.cpp.o
In file included from /home/boris/src/mygithub/filesystem/path_demo.cpp:2:0:
/home/boris/src/mygithub/filesystem/filesystem/path.h: In member function ‘std::__cxx11::string filesystem::path::str(filesystem::path::path_type) const’:
/home/boris/src/mygithub/filesystem/filesystem/path.h:200:30: error: ‘MAX_PATH’ was not declared in this scope
if (length > MAX_PATH)
^~~~~~~~
/home/boris/src/mygithub/filesystem/filesystem/path.h:200:30: note: suggested alternative: ‘_CS_PATH’
if (length > MAX_PATH)
^~~~~~~~
_CS_PATH
CMakeFiles/path_demo.dir/build.make:62: recipe for target 'CMakeFiles/path_demo.dir/path_demo.cpp.o' failed
make[2]: *** [CMakeFiles/path_demo.dir/path_demo.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/path_demo.dir/all' failed
make[1]: *** [CMakeFiles/path_demo.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

create_directories should be recursive

create_directories should be called recursively if the parent directory isn't present. Currently create_directory is called, which gives you two levels of directory but not more.

Can you add features like 'directory_iterator'?

I also don't want to use bloated boost in some situations. your code provided a good choice. But can you add the directory_iterator similar boost? I think it's very useful at some times.

can add delete directory create file function

first thanks for your code.
in work we use need delete directory file and create directory file recursively .
can you consider add them.

base create_directory in you work.
i and some function but not consider cross platform.
inline bool create_directory_deep(const path& p ) {
if (p.exists()){
return TRUE;
}

path pathParent = p.parent_path();
if (create_directory_deep(pathParent)){
	if (p.empty()) return TRUE;
	int ret = create_directory(p);
	return ret;
	//return create_directory(p);
}
else{
	false;
}
return TRUE;

}

inline void getAllFiles(string path, vector& files)
{
long hFile = 0;
struct _finddata_t fileinfo;
string p;
if ((hFile = _findfirst(p.assign(path).append("\*").c_str(), &fileinfo)) != -1)
{
do
{
if ((fileinfo.attrib & _A_SUBDIR))
{
if (strcmp(fileinfo.name, ".") != 0 && strcmp(fileinfo.name, "..") != 0)
{
// no director return
//files.push_back(p.assign(path).append("/").append(fileinfo.name));
getAllFiles(p.assign(path).append("/").append(fileinfo.name), files);
}
}
else
{
files.push_back(p.assign(path).append("/").append(fileinfo.name));
}
} while (_findnext(hFile, &fileinfo) == 0);
_findclose(hFile);
}
}

Returns "false" if testing executable with path(executable).is_file()

Running path(executable).exists() correctly returns true if the executable is there.

However, doing a path(executable).is_file() returns false, which not very intuitive to me. This happens because in the is_file call (on windows), the attribute "FILE_ATTRIBUTE_ARCHIVE" is set, but not the attribute "FILE_ATTRIBUTE_NORMAL".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.