mirror of
https://github.com/ivabus/gui
synced 2025-04-23 14:07:14 +03:00
add logic to handle tea prefix (#570)
This commit is contained in:
parent
8a6ceee712
commit
d95bbb64a2
1 changed files with 11 additions and 1 deletions
|
@ -7,6 +7,7 @@ import type { InstalledPackage } from "../../src/libs/types";
|
||||||
import { mkdirp } from "mkdirp";
|
import { mkdirp } from "mkdirp";
|
||||||
import fetch from "node-fetch";
|
import fetch from "node-fetch";
|
||||||
import { SemVer, isValidSemVer } from "@tea/libtea";
|
import { SemVer, isValidSemVer } from "@tea/libtea";
|
||||||
|
import { execSync } from "child_process";
|
||||||
|
|
||||||
type Dir = {
|
type Dir = {
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -18,7 +19,16 @@ type ParsedVersion = { full_name: string; semVer: SemVer };
|
||||||
|
|
||||||
export const getTeaPath = () => {
|
export const getTeaPath = () => {
|
||||||
const homePath = app.getPath("home");
|
const homePath = app.getPath("home");
|
||||||
const teaPath = path.join(homePath, "./.tea");
|
let teaPath;
|
||||||
|
|
||||||
|
try {
|
||||||
|
teaPath = execSync("tea --prefix", { encoding: "utf8" }).trim();
|
||||||
|
log.info(teaPath);
|
||||||
|
} catch (error) {
|
||||||
|
log.info("Could not run tea --prefix. Using default path.", info);
|
||||||
|
teaPath = path.join(homePath, "./.tea");
|
||||||
|
}
|
||||||
|
|
||||||
return teaPath;
|
return teaPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue