directory.ts 415 B

12345678910111213
  1. import { createMemo } from "solid-js"
  2. import { useSync } from "./sync"
  3. import { Global } from "@/global"
  4. export function useDirectory() {
  5. const sync = useSync()
  6. return createMemo(() => {
  7. const directory = sync.data.path.directory ?? process.cwd()
  8. const result = directory.replace(Global.Path.home, "~")
  9. if (sync.data.vcs?.branch) return result + ":" + sync.data.vcs.branch
  10. return result
  11. })
  12. }