MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / lookForFileSystems

Method lookForFileSystems

source/ui/data/globalSettings.cpp:271–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

269}
270
271void GlobalSettings::lookForFileSystems(BString path) {
272 Fs::iterateAllNativeFiles(path, true, false, [](BString filepath, bool isDir)->U32 {
273 if (filepath.endsWith(".zip", true)) {
274
275 BString fsVersion;
276 if (FsZip::readFileFromZip(filepath, B("version.txt"), fsVersion) && fsVersion.length()) {
277 BString wineVersion;
278 BString depend;
279 BString packages;
280 BString name;
281
282 fsVersion = fsVersion.trim();
283 FsZip::readFileFromZip(filepath, B("wineVersion.txt"), wineVersion);
284 wineVersion = wineVersion.trim();
285
286 FsZip::readFileFromZip(filepath, B("name.txt"), name);
287 name = name.trim();
288
289 if (name.length() == 0) {
290 name = wineVersion;
291 }
292
293 if (name.length()==0 || GlobalSettings::getFileFromFileSystemName(name).length() || (wineVersion.length() && GlobalSettings::getFileFromFileSystemName(wineVersion).length())) {
294 return 0;
295 }
296 FsZip::readFileFromZip(filepath, B("depends.txt"), depend);
297 depend = depend.trim();
298 BString dist;
299 FsZip::readFileFromZip(filepath, B("dist.txt"), dist);
300 dist = dist.trim();
301 if (dist.isEmpty()) {
302 dist = "shared";
303 }
304 FsZip::readFileFromZip(filepath, B("packages.txt"), packages);
305 std::shared_ptr<FileSystemZip> fs = std::make_shared<FileSystemZip>(name, wineVersion, fsVersion, filepath, B(""), depend);
306 GlobalSettings::fileSystemVersions.push_back(fs);
307 packages.split("\r\n", fs->tinyCorePackages);
308 if (fs->tinyCorePackages.size()) {
309 fs->tinyCoreURL = "http://" + fs->tinyCorePackages[0];
310 fs->tinyCorePackages.erase(fs->tinyCorePackages.begin());
311 }
312 if (fs->tinyCorePackages.size() && fs->tinyCorePackages[0].contains("x86/tcz/")) {
313 fs->tinyCoreBackupURL = "http://" + fs->tinyCorePackages[0];
314 fs->tinyCorePackages.erase(fs->tinyCorePackages.begin());
315 }
316 fs->dist = dist;
317 BString winetricksVersion;
318 if (FsZip::readFileFromZip(filepath, B("winetricksVersion.txt"), winetricksVersion) && winetricksVersion.length()) {
319 BString dlls;
320 BString fonts;
321 FsZip::readFileFromZip(filepath, B("dlls.txt"), dlls);
322 FsZip::readFileFromZip(filepath, B("fonts.txt"), fonts);
323 fs->wineTrickFonts = fonts;
324 fs->wineTrickDlls = dlls;
325 }
326 }
327 }
328 return 0;

Callers

nothing calls this directly

Calls 11

BFunction · 0.85
endsWithMethod · 0.80
trimMethod · 0.80
lengthMethod · 0.45
isEmptyMethod · 0.45
push_backMethod · 0.45
splitMethod · 0.45
sizeMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected