Skip to content

Commit

Permalink
Always get package root directory from src/util.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelthomas2774 committed May 7, 2022
1 parent 2dbd394 commit e46e1e4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
5 changes: 2 additions & 3 deletions src/app/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as persist from 'node-persist';
import fetch from 'node-fetch';
import dotenv from 'dotenv';
import dotenvExpand from 'dotenv-expand';
import { dev, getToken, initStorage, LoopResult, paths } from '../../util.js';
import { dev, dir, getToken, initStorage, LoopResult, paths } from '../../util.js';
import MenuApp from './menu.js';
import { ZncDiscordPresence } from '../../cli/nso/presence.js';
import { WebServiceIpc } from './webservices.js';
Expand All @@ -16,8 +16,7 @@ import { ErrorResponse } from '../../api/util.js';

const debug = createDebug('app:main');

const __dirname = path.join(import.meta.url.substr(7), '..');
export const bundlepath = path.join(import.meta.url.substr(7), '..', '..', 'bundle');
export const bundlepath = path.resolve(dir, 'dist', 'bundle');

function createWindow() {
// Create the browser window.
Expand Down
4 changes: 2 additions & 2 deletions src/cli/android-znca-api-server-frida.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import frida, { Session } from 'frida';
import express from 'express';
import bodyParser from 'body-parser';
import type { Arguments as ParentArguments } from '../cli.js';
import { ArgumentsCamelCase, Argv, getJwks, initStorage, YargsArguments } from '../util.js';
import { ArgumentsCamelCase, Argv, dir, getJwks, initStorage, YargsArguments } from '../util.js';
import { Jwt } from '../api/util.js';
import { NintendoAccountIdTokenJwtPayload } from '../api/na.js';
import { ZNCA_CLIENT_ID, ZncJwtPayload } from '../api/znc.js';
Expand Down Expand Up @@ -271,7 +271,7 @@ async function setup(argv: ArgumentsCamelCase<Arguments>) {
'-s',
argv.device,
'push',
path.join(import.meta.url.substr(7), '..', '..', '..', 'resources', 'android-znca-api-server.sh'),
path.join(dir, 'resources', 'android-znca-api-server.sh'),
'/data/local/tmp/android-znca-api-server.sh',
], {
stdio: 'inherit',
Expand Down
4 changes: 1 addition & 3 deletions src/cli/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ import * as fs from 'fs/promises';
import fetch from 'node-fetch';
import createDebug from 'debug';
import mkdirp from 'mkdirp';
import { paths, version } from '../util.js';
import { dir, paths, version } from '../util.js';

const debug = createDebug('cli:update');

const RELEASES_URL = 'https://api.github.com/repos/samuelthomas2774/nxapi/releases';

export async function checkUpdates() {
const dir = path.resolve(import.meta.url.substr(7), '..', '..', '..');

try {
await fs.stat(path.join(dir, '.git'));

Expand Down

0 comments on commit e46e1e4

Please sign in to comment.