[CodeFactor] Apply fixes

This commit is contained in:
codefactor-io 2024-01-17 18:49:14 +00:00
parent 98f48295d0
commit 552a5a9ac8
No known key found for this signature in database
GPG key ID: B66B2D63282C190F
3 changed files with 27 additions and 27 deletions

View file

@ -14,7 +14,7 @@ import { useStateStore } from "../store/stateStore.js";
const state = useStateStore(pinia);
import { settingsStore as settings } from "../store/settingsStore.js";
import {getAppDataPath} from "../js/freedata";
import { getAppDataPath } from "../js/freedata";
import { displayToast } from "./popupHandler.js";
@ -100,7 +100,7 @@ PouchDB.plugin(require("pouchdb-find"));
//PouchDB.plugin(require('pouchdb-replication'));
PouchDB.plugin(require("pouchdb-upsert"));
var appDataPath = getAppDataPath()
var appDataPath = getAppDataPath();
var configFolder = path.join(appDataPath, "FreeDATA");
var chatDB = path.join(configFolder, "chatDB");

View file

@ -1,5 +1,5 @@
const os = require('os');
const path = require('path');
const os = require("os");
const path = require("path");
/**
* Binary to ASCII replacement
@ -101,24 +101,24 @@ export function validateCallsignWithoutSSID(callsign: string) {
return true;
}
export function getAppDataPath(){
const platform = os.platform();
let appDataPath;
export function getAppDataPath() {
const platform = os.platform();
let appDataPath;
switch (platform) {
case 'darwin': // macOS
appDataPath = path.join(os.homedir(), 'Library', 'Application Support');
break;
case 'win32': // Windows
appDataPath = process.env.APPDATA || path.join(os.homedir(), 'AppData', 'Roaming');
break;
case 'linux': // Linux
appDataPath = path.join(os.homedir(), '.config');
break;
default:
throw new Error('Unsupported platform');
}
switch (platform) {
case "darwin": // macOS
appDataPath = path.join(os.homedir(), "Library", "Application Support");
break;
case "win32": // Windows
appDataPath =
process.env.APPDATA || path.join(os.homedir(), "AppData", "Roaming");
break;
case "linux": // Linux
appDataPath = path.join(os.homedir(), ".config");
break;
default:
throw new Error("Unsupported platform");
}
return appDataPath;
}
return appDataPath;
}

View file

@ -1,15 +1,15 @@
import { reactive, ref, watch } from "vue";
import { getConfig, setConfig } from "../js/api";
import {getAppDataPath} from "../js/freedata";
import { getAppDataPath } from "../js/freedata";
import fs from "fs";
const path = require('path');
const path = require("path");
const nconf = require("nconf");
var appDataPath = getAppDataPath()
var appDataPath = getAppDataPath();
var configFolder = path.join(appDataPath, "FreeDATA");
var configPath = path.join(configFolder, "config.json");
console.log('AppData Path:', appDataPath);
console.log("AppData Path:", appDataPath);
console.log(configFolder);
console.log(configPath);