MCPcopy Create free account
hub / github.com/GCWing/BitFun / detect_from_exe

Function detect_from_exe

src/apps/desktop/src/api/remote_connect_api.rs:137–166  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

135}
136
137fn detect_from_exe() -> Option<String> {
138 let exe = std::env::current_exe().ok()?;
139 let exe_dir = exe.parent()?;
140
141 let mut candidates: Vec<PathBuf> = Vec::new();
142
143 if cfg!(target_os = "macos") {
144 // Primary: tauri.conf.json maps dist -> mobile-web/dist in Resources
145 candidates.push(exe_dir.join("../Resources/mobile-web/dist"));
146 // Fallback: legacy layout without dist subdirectory
147 candidates.push(exe_dir.join("../Resources/mobile-web"));
148 // Fallback: array-format bundling may place files at Resources/dist directly
149 candidates.push(exe_dir.join("../Resources/dist"));
150 }
151 candidates.push(exe_dir.join("mobile-web/dist"));
152 candidates.push(exe_dir.join("mobile-web"));
153 candidates.push(exe_dir.join("resources/mobile-web/dist"));
154 candidates.push(exe_dir.join("resources/mobile-web"));
155
156 if cfg!(target_os = "linux") {
157 candidates.push(exe_dir.join("../lib/bitfun/mobile-web/dist"));
158 candidates.push(exe_dir.join("../lib/bitfun/mobile-web"));
159 candidates.push(exe_dir.join("../share/bitfun/mobile-web/dist"));
160 candidates.push(exe_dir.join("../share/bitfun/mobile-web"));
161 candidates.push(exe_dir.join("../share/com.bitfun.desktop/mobile-web/dist"));
162 candidates.push(exe_dir.join("../share/com.bitfun.desktop/mobile-web"));
163 }
164
165 check_candidates(&candidates, "exe-relative")
166}
167
168fn detect_from_cwd() -> Option<String> {
169 let cwd = std::env::current_dir().ok()?;

Callers 1

detect_mobile_web_dirFunction · 0.85

Calls 4

check_candidatesFunction · 0.85
okMethod · 0.45
pushMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected