Fixed #2344 (FileLister Unix: Don't convert to absolute paths)
This commit is contained in:
parent
be46d453c4
commit
b89f486d0d
|
@ -37,7 +37,10 @@
|
||||||
////// This code is POSIX-style systems ///////////////////////////////////////
|
////// This code is POSIX-style systems ///////////////////////////////////////
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void FileListerUnix::recursiveAddFiles(std::vector<std::string> &filenames, const std::string &path)
|
|
||||||
|
void FileListerUnix::recursiveAddFiles2(std::vector<std::string> &relative,
|
||||||
|
std::vector<std::string> &absolute,
|
||||||
|
const std::string &path)
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << path;
|
oss << path;
|
||||||
|
@ -59,26 +62,37 @@ void FileListerUnix::recursiveAddFiles(std::vector<std::string> &filenames, cons
|
||||||
if (!fname)
|
if (!fname)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (std::find(filenames.begin(), filenames.end(), std::string(fname)) != filenames.end())
|
// Does absolute path exist? then bail out
|
||||||
|
if (std::find(absolute.begin(), absolute.end(), std::string(fname)) != absolute.end())
|
||||||
{
|
{
|
||||||
free(fname);
|
free(fname);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sameFileName(path,fname) || FileLister::acceptFile(filename))
|
if (sameFileName(path,filename) || FileListerUnix::acceptFile(filename))
|
||||||
filenames.push_back(fname);
|
{
|
||||||
|
relative.push_back(filename);
|
||||||
|
absolute.push_back(fname);
|
||||||
|
}
|
||||||
|
|
||||||
free(fname);
|
free(fname);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Directory
|
// Directory
|
||||||
getFileLister()->recursiveAddFiles(filenames, filename);
|
recursiveAddFiles2(relative, absolute, filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
globfree(&glob_results);
|
globfree(&glob_results);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FileListerUnix::recursiveAddFiles(std::vector<std::string> &filenames, const std::string &path)
|
||||||
|
{
|
||||||
|
std::vector<std::string> abs;
|
||||||
|
recursiveAddFiles2(filenames, abs, path);
|
||||||
|
}
|
||||||
|
|
||||||
bool FileListerUnix::sameFileName(const std::string &fname1, const std::string &fname2)
|
bool FileListerUnix::sameFileName(const std::string &fname1, const std::string &fname2)
|
||||||
{
|
{
|
||||||
#if defined(__linux__) || defined(__sun)
|
#if defined(__linux__) || defined(__sun)
|
||||||
|
|
|
@ -34,7 +34,11 @@ public:
|
||||||
virtual bool sameFileName(const std::string &fname1, const std::string &fname2);
|
virtual bool sameFileName(const std::string &fname1, const std::string &fname2);
|
||||||
// virtual static bool acceptFile(const std::string &filename);
|
// virtual static bool acceptFile(const std::string &filename);
|
||||||
private:
|
private:
|
||||||
|
#ifndef _WIN32
|
||||||
|
void recursiveAddFiles2(std::vector<std::string> &relative,
|
||||||
|
std::vector<std::string> &absolute,
|
||||||
|
const std::string &path);
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
Loading…
Reference in New Issue