| 22 | #include "../../util/networkutils.h" |
| 23 | |
| 24 | bool BoxedContainer::load(BString dirPath) { |
| 25 | this->dirPath = dirPath; |
| 26 | BString iniFilePath = this->dirPath.stringByApppendingPath("container.ini"); |
| 27 | ConfigFile config(iniFilePath); |
| 28 | this->name = config.readString(B("Name"), B("")); |
| 29 | BString wineVersion = config.readString(B("WineVersion"), B("")); // compat |
| 30 | this->fileSystemZipName = config.readString(B("FileSystemZipName"), wineVersion); |
| 31 | this->fileSystem = GlobalSettings::getInstalledFileSystemFromName(fileSystemZipName); |
| 32 | loadInstalledPackageList(); |
| 33 | |
| 34 | int i = 1; |
| 35 | while (true) { |
| 36 | BString mount = config.readString("Mount" + BString::valueOf(i), B("")); |
| 37 | if (mount.length() == 0) { |
| 38 | break; |
| 39 | } |
| 40 | std::vector<BString> parts; |
| 41 | mount.split('|', parts); |
| 42 | if (parts.size() != 2) { |
| 43 | kwarn_fmt("Failed to parse container %s mount command %s", this->name.c_str(), mount.c_str()); |
| 44 | break; |
| 45 | } |
| 46 | this->mounts.push_back(MountInfo(parts[0], parts[1], parts[0].length() == 1)); |
| 47 | i++; |
| 48 | } |
| 49 | bool result = this->name.length()>0; |
| 50 | if (result) { |
| 51 | this->loadApps(); |
| 52 | } |
| 53 | return result; |
| 54 | } |
| 55 | |
| 56 | BoxedContainer::~BoxedContainer() { |
| 57 | for (auto& app : this->apps) { |
no test coverage detected