MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / create

Method create

Examples/SCExample/HotReloadSystem.h:78–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76 PluginRegistry registry;
77
78 Result create(AsyncEventLoop& loop, const Options& options)
79 {
80 registry.init(storage);
81 eventLoop = &loop;
82 FileSystem fs;
83 SC_TRY(fs.init("."));
84 FileSystem::Operations::getExecutablePath(state.executablePath);
85 SC_TRY(state.executableDirectory.assign(Path::dirname(state.executablePath.view(), Path::AsNative)));
86 SC_TRY_MSG(not options.examplesPath.isEmpty(), "HotReloadSystem missing examples path");
87 SC_TRY(state.examplesPath.assign(options.examplesPath));
88 SC_TRY_MSG(fs.existsAndIsDirectory(state.examplesPath.view()), "HotReloadSystem examples path does not exist");
89 StringView iosSysroot = "/var/mobile/theos/sdks/iPhoneOS14.4.sdk";
90 if (FileSystem().existsAndIsDirectory(iosSysroot))
91 {
92 memcpy(state.isysroot, iosSysroot.bytesIncludingTerminator(), iosSysroot.sizeInBytesIncludingTerminator());
93 setSysroot(iosSysroot);
94 }
95
96 // Setup Compiler
97 SC_TRY(PluginCompiler::findBestCompiler(compiler));
98 SC_TRY(PluginSysroot::findBestSysroot(compiler.type, sysroot));
99 SC_TRY(state.includePathsText.assign(options.defaultIncludePathsText));
100 SC_TRY(rebuildCompilerIncludePaths());
101
102 // Setup File System Watcher
103 fileSystemWatcherRunner.init(*eventLoop);
104 SC_TRY(fileSystemWatcher.init(fileSystemWatcherRunner));
105 folderWatcher.notifyCallback.bind<HotReloadSystem, &HotReloadSystem::onFileChange>(*this);
106 SC_TRY(fileSystemWatcher.watch(folderWatcher, state.examplesPath.view()));
107 return Result(true);
108 }
109
110 Result close()
111 {

Callers

nothing calls this directly

Calls 9

getExecutablePathFunction · 0.85
dirnameFunction · 0.85
existsAndIsDirectoryMethod · 0.80
watchMethod · 0.80
ResultClass · 0.50
initMethod · 0.45
assignMethod · 0.45
viewMethod · 0.45
isEmptyMethod · 0.45

Tested by

no test coverage detected