File Property folders
This commit is contained in:
@@ -2052,13 +2052,13 @@ std::vector<FileEntry> PiPedalModel::GetFileList2(const std::string &relativePat
|
||||
}
|
||||
}
|
||||
|
||||
std::string PiPedalModel::RenameSampleFile(
|
||||
std::string PiPedalModel::RenameFilePropertyFile(
|
||||
const std::string&oldRelativePath,
|
||||
const std::string&newRelativePath,
|
||||
const UiFileProperty&uiFileProperty)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||
return storage.RenameSampleFile(oldRelativePath,newRelativePath,uiFileProperty);
|
||||
return storage.RenameFilePropertyFile(oldRelativePath,newRelativePath,uiFileProperty);
|
||||
}
|
||||
|
||||
void PiPedalModel::DeleteSampleFile(const std::filesystem::path &fileName)
|
||||
@@ -2073,10 +2073,10 @@ std::string PiPedalModel::CreateNewSampleDirectory(const std::string&relativePat
|
||||
return storage.CreateNewSampleDirectory(relativePath, uiFileProperty);
|
||||
|
||||
}
|
||||
FilePropertyDirectoryTree::ptr PiPedalModel::GetSampleDirectoryTree(const UiFileProperty&uiFileProperty)
|
||||
FilePropertyDirectoryTree::ptr PiPedalModel::GetFilePropertydirectoryTree(const UiFileProperty&uiFileProperty)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||
return storage.GetSampleDirectoryTree(uiFileProperty);
|
||||
return storage.GetFilePropertydirectoryTree(uiFileProperty);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -333,8 +333,8 @@ namespace pipedal
|
||||
|
||||
void DeleteSampleFile(const std::filesystem::path &fileName);
|
||||
std::string CreateNewSampleDirectory(const std::string&relativePath, const UiFileProperty&uiFileProperty);
|
||||
std::string RenameSampleFile(const std::string&oldRelativePath,const std::string&newRelativePath,const UiFileProperty&uiFileProperty);
|
||||
FilePropertyDirectoryTree::ptr GetSampleDirectoryTree(const UiFileProperty&uiFileProperty);
|
||||
std::string RenameFilePropertyFile(const std::string&oldRelativePath,const std::string&newRelativePath,const UiFileProperty&uiFileProperty);
|
||||
FilePropertyDirectoryTree::ptr GetFilePropertydirectoryTree(const UiFileProperty&uiFileProperty);
|
||||
|
||||
std::string UploadUserFile(const std::string &directory, const std::string &patchProperty,const std::string&filename,const std::string&fileBody);
|
||||
uint64_t CreateNewPreset();
|
||||
|
||||
@@ -1488,18 +1488,18 @@ public:
|
||||
std::string newFileName = this->model.CreateNewSampleDirectory(args.relativePath_,args.uiFileProperty_);
|
||||
this->Reply(replyTo,"createNewSampleDirectory",newFileName);
|
||||
}
|
||||
else if (message == "renameSampleFile")
|
||||
else if (message == "renameFilePropertyFile")
|
||||
{
|
||||
RenameSampleFileArgs args;
|
||||
pReader->read(&args);
|
||||
|
||||
std::string newFileName = this->model.RenameSampleFile(args.oldRelativePath_,args.newRelativePath_,args.uiFileProperty_);
|
||||
this->Reply(replyTo,"renameSampleFile",newFileName);
|
||||
} else if (message == "GetSampleDirectoryTree"){
|
||||
std::string newFileName = this->model.RenameFilePropertyFile(args.oldRelativePath_,args.newRelativePath_,args.uiFileProperty_);
|
||||
this->Reply(replyTo,"renameFilePropertyFile",newFileName);
|
||||
} else if (message == "getFilePropertyDirectoryTree"){
|
||||
UiFileProperty uiFileProperty;
|
||||
pReader->read(&uiFileProperty);
|
||||
FilePropertyDirectoryTree::ptr result = model.GetSampleDirectoryTree(uiFileProperty);
|
||||
this->Reply(replyTo,"GetSampleDirectoryTree",result);
|
||||
FilePropertyDirectoryTree::ptr result = model.GetFilePropertydirectoryTree(uiFileProperty);
|
||||
this->Reply(replyTo,"GetFilePropertydirectoryTree",result);
|
||||
|
||||
}
|
||||
|
||||
|
||||
+10
-7
@@ -1748,7 +1748,7 @@ std::string Storage::CreateNewSampleDirectory(const std::string&relativePath, co
|
||||
return path;
|
||||
|
||||
}
|
||||
std::string Storage::RenameSampleFile(
|
||||
std::string Storage::RenameFilePropertyFile(
|
||||
const std::string&oldRelativePath,
|
||||
const std::string&newRelativePath,
|
||||
const UiFileProperty&uiFileProperty)
|
||||
@@ -1789,12 +1789,15 @@ std::string Storage::RenameSampleFile(
|
||||
|
||||
void Storage::FillSampleDirectoryTree(FilePropertyDirectoryTree*node, const std::filesystem::path&directory) const
|
||||
{
|
||||
for (auto child: std::filesystem::recursive_directory_iterator(directory))
|
||||
for (auto child: std::filesystem::directory_iterator(directory))
|
||||
{
|
||||
const auto& childPath = child.path();
|
||||
FilePropertyDirectoryTree::ptr childTree = std::make_unique<FilePropertyDirectoryTree>(childPath.filename());
|
||||
FillSampleDirectoryTree(childTree.get(),childPath);
|
||||
node->children_.push_back(std::move(childTree));
|
||||
if (child.is_directory())
|
||||
{
|
||||
const auto& childPath = child.path();
|
||||
FilePropertyDirectoryTree::ptr childTree = std::make_unique<FilePropertyDirectoryTree>(childPath.filename());
|
||||
FillSampleDirectoryTree(childTree.get(),childPath);
|
||||
node->children_.push_back(std::move(childTree));
|
||||
}
|
||||
}
|
||||
std::sort(node->children_.begin(),node->children_.end(),
|
||||
[this](const FilePropertyDirectoryTree::ptr&left,const FilePropertyDirectoryTree::ptr&right)
|
||||
@@ -1802,7 +1805,7 @@ void Storage::FillSampleDirectoryTree(FilePropertyDirectoryTree*node, const std:
|
||||
return this->locale(left->directoryName_,right->directoryName_);
|
||||
});
|
||||
}
|
||||
FilePropertyDirectoryTree::ptr Storage::GetSampleDirectoryTree(const UiFileProperty&uiFileProperty) const
|
||||
FilePropertyDirectoryTree::ptr Storage::GetFilePropertydirectoryTree(const UiFileProperty&uiFileProperty) const
|
||||
{
|
||||
FilePropertyDirectoryTree::ptr result = std::make_unique<FilePropertyDirectoryTree>("");
|
||||
if (uiFileProperty.directory().empty())
|
||||
|
||||
+2
-2
@@ -220,11 +220,11 @@ public:
|
||||
void DeleteSampleFile(const std::filesystem::path &fileName);
|
||||
std::string UploadUserFile(const std::string &directory, const std::string &patchProperty,const std::string&filename,const std::string&fileBody);
|
||||
std::string CreateNewSampleDirectory(const std::string&relativePath, const UiFileProperty&uiFileProperty);
|
||||
std::string RenameSampleFile(
|
||||
std::string RenameFilePropertyFile(
|
||||
const std::string&oldRelativePath,
|
||||
const std::string&newRelativePath,
|
||||
const UiFileProperty&uiFileProperty);
|
||||
FilePropertyDirectoryTree::ptr GetSampleDirectoryTree(const UiFileProperty&uiFileProperty) const;
|
||||
FilePropertyDirectoryTree::ptr GetFilePropertydirectoryTree(const UiFileProperty&uiFileProperty) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user