Skip to content

Commit

Permalink
fix: use correct import
Browse files Browse the repository at this point in the history
  • Loading branch information
Saschl committed Sep 30, 2024
1 parent f352612 commit df81a38
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/renderer/components/LocalApiConfigEditUI/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import React, { FC, useEffect, useState } from 'react';
import * as print from 'pdf-to-printer';
import { PromptModal, useModals } from '../Modal';
import { Button, ButtonType } from '../Button';
import app from 'electron';
import fs from 'fs';
import path from 'path';
import { Directories } from 'renderer/utils/Directories';
import { Toggle } from '../Toggle';
import { app } from '@electron/remote';

const SIMBRIDGE_DIRECTORY = '/FlyByWireSim/Simbridge';

Expand Down Expand Up @@ -38,11 +37,11 @@ const localApiDefaultConfiguration: LocalApiConfiguration = {

class LocalApiConfigurationHandler {
private static get simbridgeDirectory(): string {
return path.join(Directories.inInstallLocation(SIMBRIDGE_DIRECTORY));
return path.join(app.getPath('documents'), SIMBRIDGE_DIRECTORY);
}

private static get simbridgeConfigPath(): string {
return path.join(app.getPath('documents'), SIMBRIDGE_DIRECTORY, 'resources', 'properties.json');
return path.join(this.simbridgeDirectory, 'resources', 'properties.json');
}

static getConfiguration(): LocalApiConfiguration {
Expand All @@ -53,7 +52,7 @@ class LocalApiConfigurationHandler {
} else {
console.log(`No configuration found at ${this.simbridgeConfigPath}`);

if (fs.existsSync(path.join(app.getPath('documents'), SIMBRIDGE_DIRECTORY, 'resources'))) {
if (fs.existsSync(path.join(this.simbridgeDirectory, 'resources'))) {
console.log(`Creating configuration at ${this.simbridgeConfigPath}`);

fs.writeFileSync(path.join(this.simbridgeConfigPath), JSON.stringify(localApiDefaultConfiguration));
Expand Down

0 comments on commit df81a38

Please sign in to comment.