diff --git a/electron/lib/getLogsFolderPath.js b/electron/lib/getRuntimeFolderPath.js similarity index 69% rename from electron/lib/getLogsFolderPath.js rename to electron/lib/getRuntimeFolderPath.js index f68261bd0f..ce96342f87 100644 --- a/electron/lib/getLogsFolderPath.js +++ b/electron/lib/getRuntimeFolderPath.js @@ -3,13 +3,13 @@ import path from 'path'; export default (platform, env, appName) => { switch (platform) { case 'darwin': { - return path.join(env['HOME'], 'Library', 'Application Support', appName, 'Logs'); + return path.join(env['HOME'], 'Library', 'Application Support', appName); } case 'win32': { - return path.join(env['APPDATA'], appName, 'Logs'); + return path.join(env['APPDATA'], appName); } case 'linux': { - return path.join(env['HOME'], '.config', appName, 'Logs'); + return path.join(env['HOME'], '.config', appName); } default: { console.log('Unsupported platform'); diff --git a/electron/main.development.js b/electron/main.development.js index 70817a9d22..01e0193a29 100755 --- a/electron/main.development.js +++ b/electron/main.development.js @@ -6,16 +6,20 @@ import Log from 'electron-log'; import osxMenu from './menus/osx'; import winLinuxMenu from './menus/win-linux'; import ipcApi from './ipc-api'; -import getLogsFolderPath from './lib/getLogsFolderPath'; +import getRuntimeFolderPath from './lib/getRuntimeFolderPath'; import { daedalusLogger } from './lib/remoteLog'; const APP_NAME = 'Daedalus'; // Configure default logger levels for console and file outputs -const appLogFolderPath = getLogsFolderPath(process.platform, process.env, APP_NAME); +const runtimeFolderPath = getRuntimeFolderPath(process.platform, process.env, APP_NAME); +const appLogFolderPath = path.join(runtimeFolderPath, 'Logs') const logFilePath = path.join(appLogFolderPath, APP_NAME + '.log'); Log.transports.console.level = 'warn'; Log.transports.file.level = 'debug'; Log.transports.file.file = logFilePath; +// TODO: depends on launcher script current directory, move this to getRuntimeFolderPath location +//const caProductionPath = path.join(runtimeFolderPath, 'CA', 'tls', 'ca', 'ca.crt'); +const caProductionPath = path.join(process.cwd(), 'tls', 'ca', 'ca.crt'); try { let sendLogsToRemoteServer; @@ -140,16 +144,16 @@ app.on('ready', async () => { * so that it can be used in HTTP and Websocket connections. */ try { - // Path to certificate in development - let pathToCertificate = '../tls/ca.crt'; - if (isProd) { - // --> PATH TO CERTIFICATE IN PRODUCTION: - pathToCertificate = '../../../tls/ca/ca.crt'; + var pathToCertificate = caProductionPath; + } else { + // Path to certificate in development + var pathToCertificate = path.join(__dirname, '../tls/ca.crt'); } + Log.info('Using certificates from: ' + caProductionPath); Object.assign(global, { - ca: fs.readFileSync(path.join(__dirname, pathToCertificate)), + ca: fs.readFileSync(pathToCertificate), }); } catch (error) { diff --git a/installers/Launcher.hs b/installers/Launcher.hs index d220fa2fec..dda24282c4 100644 --- a/installers/Launcher.hs +++ b/installers/Launcher.hs @@ -48,9 +48,9 @@ launcherArgs launcher = unwords $ batchCmdNewline | os == "mingw32" = "^\r\n" | otherwise = mempty walletTopology | os == "mingw32" = ["--topology", quote "%DAEDALUS_DIR%\\wallet-topology.yaml"] - | otherwise = mempty + | otherwise = ["--topology", quote "./wallet-topology.yaml"] tlsBase | os == "mingw32" = "%DAEDALUS_DIR%\\" <> "tls" <> (pathSeparator : []) - | otherwise = runtimePath launcher <> "tls" <> (pathSeparator : []) + | otherwise = "./" <> "tls" <> (pathSeparator : []) quote :: String -> String quote p = "\"" <> p <> "\"" diff --git a/installers/MacInstaller.hs b/installers/MacInstaller.hs index 02181a66c5..0f740c43d1 100644 --- a/installers/MacInstaller.hs +++ b/installers/MacInstaller.hs @@ -33,6 +33,7 @@ main = do echo "Preparing files ..." copyFile "cardano-launcher" (dir <> "/cardano-launcher") copyFile "cardano-node" (dir <> "/cardano-node") + copyFile "wallet-topology.yaml" (dir <> "/wallet-topology.yaml") copyFile "log-config-prod.yaml" (dir <> "/log-config-prod.yaml") copyFile "data/ip-dht-mappings" (dir <> "/ip-dht-mappings") copyFile "data/ip-dht-mappings" (dir <> "/ip-dht-mappings")