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

Method startApp

source/ui/data/boxedwineData.cpp:76–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74#endif
75
76void BoxedwineData::startApp() {
77#ifdef BOXEDWINE_UI_LAUNCH_IN_PROCESS
78 GlobalSettings::startUpArgs.apply();
79 if (!GlobalSettings::keepUIRunning && uiIsRunning()) {
80 uiShutdown();
81 }
82#else
83
84#if defined(__MACH__)
85 std::vector<BString> args = GlobalSettings::startUpArgs.buildArgs();
86 BString now;
87 now.append((U32)(KSystem::getSystemTimeAsMicroSeconds() / 100000));
88 args.insert(args.begin(), now);
89 writeLinesToFile(GlobalSettings::getArgsPath(), args);
90 MacPlatformLaunchAnotherInstance();
91 BString filePath = GlobalSettings::getDataFolder().stringByApppendingPath(now+".txt");
92 bool started = false;
93 U32 startTime = KSystem::getMilliesSinceStart();
94 bool windowCreated = false;
95
96 while (true) {
97 bool running = MacPlatformIsTaskRunning();
98 if (!started) {
99 if (running) {
100 started = true;
101 } else {
102 if (KSystem::getMilliesSinceStart() - startTime > 10000) {
103 break;
104 }
105 }
106 } else if (!running) {
107 break; // we started but are no longer running
108 }
109 if (windowCreated) {
110 if (uiIsRunning()) {
111 uiShutdown();
112 }
113 } else {
114 if (Fs::doesNativePathExist(filePath)) {
115 windowCreated = true;
116 Fs::deleteNativeFile(filePath);
117 }
118 uiLoop();
119 }
120 uiPumpEvents(); // without this, swift won't get the isTerminated msg
121 KNativeThread::sleep(16);
122 }
123 Fs::deleteNativeFile(filePath);
124#else
125 std::vector<BString> a = GlobalSettings::startUpArgs.buildArgs();
126 BString log;
127 BString cmd = GlobalSettings::getExeFilePath();
128
129 log = "Starting process: " + GlobalSettings::getExeFilePath() + " ";
130 cmd += " ";
131 for (auto& arg : a) {
132 log += "\"" + arg + "\" ";
133 cmd += "\"" + arg + "\" ";

Callers

nothing calls this directly

Calls 15

uiIsRunningFunction · 0.85
uiShutdownFunction · 0.85
writeLinesToFileFunction · 0.85
uiLoopFunction · 0.85
uiPumpEventsFunction · 0.85
buildArgsMethod · 0.80
startsWithMethod · 0.80
substrMethod · 0.80
applyMethod · 0.45
appendMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected