Merge pull request #28 from flowln/fix_copy
This commit is contained in:
commit
194822f11e
@ -187,7 +187,7 @@ bool copy::operator()(const QString& offset)
|
||||
// blacklisted paths, so we iterate over the source directory, and if there's no blacklist
|
||||
// match, we copy the file.
|
||||
QDir src_dir(src);
|
||||
QDirIterator source_it(src, QDir::Filter::Files, QDirIterator::Subdirectories);
|
||||
QDirIterator source_it(src, QDir::Filter::Files | QDir::Filter::Hidden, QDirIterator::Subdirectories);
|
||||
|
||||
while (source_it.hasNext()) {
|
||||
auto src_path = source_it.next();
|
||||
|
@ -147,6 +147,42 @@ slots:
|
||||
f();
|
||||
}
|
||||
|
||||
void test_copy_with_dot_hidden()
|
||||
{
|
||||
QString folder = QFINDTESTDATA("testdata/FileSystem/test_folder");
|
||||
auto f = [&folder]()
|
||||
{
|
||||
QTemporaryDir tempDir;
|
||||
tempDir.setAutoRemove(true);
|
||||
qDebug() << "From:" << folder << "To:" << tempDir.path();
|
||||
|
||||
QDir target_dir(FS::PathCombine(tempDir.path(), "test_folder"));
|
||||
qDebug() << tempDir.path();
|
||||
qDebug() << target_dir.path();
|
||||
FS::copy c(folder, target_dir.path());
|
||||
c();
|
||||
|
||||
auto filter = QDir::Filter::Files | QDir::Filter::Dirs | QDir::Filter::Hidden;
|
||||
|
||||
for (auto entry: target_dir.entryList(filter)) {
|
||||
qDebug() << entry;
|
||||
}
|
||||
|
||||
QVERIFY(target_dir.entryList(filter).contains(".secret_folder"));
|
||||
target_dir.cd(".secret_folder");
|
||||
QVERIFY(target_dir.entryList(filter).contains(".secret_file.txt"));
|
||||
};
|
||||
|
||||
// first try variant without trailing /
|
||||
QVERIFY(!folder.endsWith('/'));
|
||||
f();
|
||||
|
||||
// then variant with trailing /
|
||||
folder.append('/');
|
||||
QVERIFY(folder.endsWith('/'));
|
||||
f();
|
||||
}
|
||||
|
||||
void test_getDesktop()
|
||||
{
|
||||
QCOMPARE(FS::getDesktopDir(), QStandardPaths::writableLocation(QStandardPaths::DesktopLocation));
|
||||
|
1
tests/testdata/FileSystem/test_folder/.secret_folder/.secret_file.txt
vendored
Normal file
1
tests/testdata/FileSystem/test_folder/.secret_folder/.secret_file.txt
vendored
Normal file
@ -0,0 +1 @@
|
||||
oooooo spooky easter egg :oo
|
Loading…
Reference in New Issue
Block a user