~bmp/hayom

a6e57695974770dbecd4c2d88aaf4c3288092feb — Benjamin Pollack 6 months ago 23c12bc
support Windows

Fixes https://todo.sr.ht/~bmp/hayom/1
1 files changed, 10 insertions(+), 3 deletions(-)

M config.ts
M config.ts => config.ts +10 -3
@@ 12,7 12,9 @@ export interface Config {

function homeDir(): string {
  if (Deno.build.os === "windows") {
    throw new Error("Not supported yet");
    const home = Deno.env.get("USERPROFILE");
    if (home == null) throw new Error("USERPROFILE missing");
    return home;
  } else {
    const home = Deno.env.get("HOME");
    if (home == null) throw new Error("$HOME missing");


@@ 22,7 24,9 @@ function homeDir(): string {

function configDir(): string {
  if (Deno.build.os === "windows") {
    throw new Error("Not supported yet");
    const profile = Deno.env.get("APPDATA");
    if (profile == null) throw new Error("APPDATA missing");
    return profile;
  } else {
    let configRoot = Deno.env.get("XDG_CONFIG_HOME");
    if (configRoot == null) {


@@ 37,7 41,10 @@ function defaultConfigPath(): string {
}

function defaultJournalPath(): string {
  return path.join(homeDir(), ".journal");
  return path.join(
    homeDir(),
    Deno.build.os === "windows" ? "hayom.txt" : ".hayom",
  );
}

function defaultEditor(): string {