MCPcopy Create free account
hub / github.com/ZL-Audio/ZLEqualizer / checkCreateDirectory

Method checkCreateDirectory

source/state/property.cpp:40–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38 }
39
40 bool Property::checkCreateDirectory() const {
41 // create directory if not exists
42 if (!kPath.isDirectory()) {
43 if (!kPath.createDirectory()) {
44 return false;
45 }
46 }
47 // check if UI preset exists
48 if (kUIPath.existsAsFile()) {
49 return true;
50 }
51 // check if old UI preset exists
52 // yes -> copy old UI preset to UI preset
53 if (kOldUIPath.existsAsFile()) {
54 if (const auto c_res = kOldUIPath.copyFileTo(kUIPath); c_res) {
55 if (const auto d_res = kOldUIPath.deleteFile(); d_res) {
56 return true;
57 }
58 }
59 }
60 // no -> create a blank UI preset
61 const auto res = kUIPath.create();
62 return res.wasOk();
63 }
64}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected