Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8afaf91a authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "snapshotctl: Check for empty directory" into main am: 182b9333

parents 229f99ad 182b9333
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -649,6 +649,12 @@ bool ApplyUpdate(int argc, char** argv) {
            metadata_on_super = true;
        }
    }

    if (!std::filesystem::exists(path) || std::filesystem::is_empty(path)) {
        LOG(ERROR) << path << " doesn't exist";
        return false;
    }

    MapSnapshots cow(path, metadata_on_super);
    if (!cow.ApplyUpdate()) {
        return false;
@@ -921,6 +927,11 @@ bool MapPrecreatedSnapshots(int argc, char** argv) {
    std::string path = std::string(argv[2]);
    std::vector<std::string> patchfiles;

    if (!std::filesystem::exists(path) || std::filesystem::is_empty(path)) {
        LOG(ERROR) << path << " doesn't exist";
        return false;
    }

    for (const auto& entry : std::filesystem::directory_iterator(path)) {
        if (android::base::EndsWith(entry.path().generic_string(), ".patch")) {
            patchfiles.push_back(android::base::Basename(entry.path().generic_string()));