Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t.sh

Commit

The desktop app's runner lives in its local data folder, which stays on the computer: %LOCALAPPDATA%\sh.g1t.desktop\runner on Windows, where it was in roaming data (%APPDATA%), which networks with roaming profiles copy to a profile server along with everything else there, the sandbox's VM disk and the runner's credential included. A computer whose runner was already set up in roaming data keeps it where it is, since its WSL distribution is registered at that path and moving its disk would break it; on macOS and Linux the two folders were always the same one. The desktop guide gives the new place.

syntaqxcommitted Parentc448de5Browse files
2 files+35−40/2 viewed
+30−1
271271 }
272272 }
273273
274+/// Where the runner keeps everything: its program, registrations, log and
275+/// the sandbox's VM. In the app's local data, which stays on this computer:
276+/// roaming data (Windows' %APPDATA%) is copied to a profile server on
277+/// networks with roaming profiles, and a VM's disk and a runner's
278+/// credential have no business there. A computer whose runner already
279+/// lives in roaming data keeps it there: its WSL distribution is
280+/// registered at that path, and moving its disk would break it. On macOS
281+/// and Linux the two are the same folder.
274282 fn folder(app: &AppHandle) -> PathBuf {
275− app.path().app_data_dir().unwrap_or_else(|_| std::env::temp_dir().join("sh.g1t.desktop")).join("runner")
283+ let fallback = || std::env::temp_dir().join("sh.g1t.desktop");
284+ let local = app.path().app_local_data_dir().unwrap_or_else(|_| fallback()).join("runner");
285+ let roaming = app.path().app_data_dir().unwrap_or_else(|_| fallback()).join("runner");
286+ chosen_folder(local, roaming)
276287 }
277288
289+/// The local folder, unless the runner was set up in the roaming one before.
290+fn chosen_folder(local: PathBuf, roaming: PathBuf) -> PathBuf {
291+ if !local.exists() && roaming.exists() { roaming } else { local }
292+}
293+
278294 impl Registration {
279295 fn path(app: &AppHandle) -> PathBuf {
280296 folder(app).join("registration.json")
22042220 }
22052221
22062222 #[test]
2223+ fn a_new_runner_lives_in_local_data_and_an_old_one_stays_put() {
2224+ let base = std::env::temp_dir().join(format!("g1t-desktop-folders-{}", std::process::id()));
2225+ let _ = std::fs::remove_dir_all(&base);
2226+ let (local, roaming) = (base.join("local").join("runner"), base.join("roaming").join("runner"));
2227+ assert_eq!(chosen_folder(local.clone(), roaming.clone()), local);
2228+ std::fs::create_dir_all(&roaming).unwrap();
2229+ assert_eq!(chosen_folder(local.clone(), roaming.clone()), roaming);
2230+ std::fs::create_dir_all(&local).unwrap();
2231+ assert_eq!(chosen_folder(local.clone(), roaming), local);
2232+ let _ = std::fs::remove_dir_all(&base);
2233+ }
2234+
2235+ #[test]
22072236 fn when_is_said_as_the_site_reads_it() {
22082237 let at = |seconds: u64| rfc3339(SystemTime::UNIX_EPOCH + Duration::from_secs(seconds));
22092238 assert_eq!(at(0), "1970-01-01T00:00:00Z");
+5−3
214214 firmware (Intel VT-x or AMD-V), which most computers have on.
215215
216216 For the sandbox, the app runs the same commands you would, with its own
217−copy of `g1t-runner` and its state in the app's data folder
218−(`%APPDATA%\sh.g1t.desktop\runner` on Windows,
219−`~/Library/Application Support/sh.g1t.desktop/runner` on macOS,
217+copy of `g1t-runner` and its state in the app's local data folder, which
218+never roams to other computers with your profile
219+(`%LOCALAPPDATA%\sh.g1t.desktop\runner` on Windows, or
220+`%APPDATA%\sh.g1t.desktop\runner` where an earlier version set it up;
221+`~/Library/Application Support/sh.g1t.desktop/runner` on macOS;
220222 `~/.local/share/sh.g1t.desktop/runner` on Linux):
221223
222224 | When | The app runs |

Comments

Sign in to comment.