windows cli fixes

Signed-off-by: FTCHD <144691102+FTCHD@users.noreply.github.com>
This commit is contained in:
FTCHD
2025-09-23 20:27:35 +02:00
parent 98c985dad4
commit d2e0d1018a
5 changed files with 24 additions and 15 deletions
+6 -6
View File
@@ -2,7 +2,7 @@ import { appLocalDataDir, sep } from '@tauri-apps/api/path'
import { exists, mkdir, writeTextFile } from '@tauri-apps/plugin-fs' import { exists, mkdir, writeTextFile } from '@tauri-apps/plugin-fs'
import { fetch } from '@tauri-apps/plugin-http' import { fetch } from '@tauri-apps/plugin-http'
import { Command } from '@tauri-apps/plugin-shell' import { Command } from '@tauri-apps/plugin-shell'
import { RCLONE_CONF_REGEX } from './constants' import { DOUBLE_BACKSLASH_REGEX, RCLONE_CONF_REGEX } from './constants'
export async function getDefaultPaths() { export async function getDefaultPaths() {
console.log('[getDefaultPaths]') console.log('[getDefaultPaths]')
@@ -20,12 +20,12 @@ export async function getDefaultPaths() {
console.log('[getDefaultPaths] json', JSON.stringify(defaultPaths, null, 2)) console.log('[getDefaultPaths] json', JSON.stringify(defaultPaths, null, 2))
const doubleBackslashRegex = /\\\\/g
return { return {
cache: defaultPaths.cache ? defaultPaths.cache.replace(doubleBackslashRegex, '\\') : '', cache: defaultPaths.cache ? defaultPaths.cache.replace(DOUBLE_BACKSLASH_REGEX, '\\') : '',
config: defaultPaths.config ? defaultPaths.config.replace(doubleBackslashRegex, '\\') : '', config: defaultPaths.config
temp: defaultPaths.temp ? defaultPaths.temp.replace(doubleBackslashRegex, '\\') : '', ? defaultPaths.config.replace(DOUBLE_BACKSLASH_REGEX, '\\')
: '',
temp: defaultPaths.temp ? defaultPaths.temp.replace(DOUBLE_BACKSLASH_REGEX, '\\') : '',
} }
} }
+1
View File
@@ -15,3 +15,4 @@ export const RCLONE_VFS_DEFAULTS = {
} }
export const RCLONE_CONF_REGEX = /[\/\\]rclone\.conf$/ export const RCLONE_CONF_REGEX = /[\/\\]rclone\.conf$/
export const DOUBLE_BACKSLASH_REGEX = /\\\\/g
+1 -1
View File
@@ -177,7 +177,7 @@ async function startRclone() {
command.addListener('close', async (event) => { command.addListener('close', async (event) => {
console.log('close', event) console.log('close', event)
if (event.code === 1 || event.code === 143) { if (event.code === 143 || (platform() === 'windows' && event.code === 1)) {
Sentry.captureException(new Error('Rclone has crashed')) Sentry.captureException(new Error('Rclone has crashed'))
const confirmed = await ask('Rclone has crashed', { const confirmed = await ask('Rclone has crashed', {
title: 'Error', title: 'Error',
+1
View File
@@ -40,6 +40,7 @@ export default function TemplatesDropdown({
type="button" type="button"
color="primary" color="primary"
className="min-w-fit" className="min-w-fit"
variant="shadow"
// className="max-w-2xl gap-2" // className="max-w-2xl gap-2"
// data-focus-visible="false" // data-focus-visible="false"
> >
+15 -8
View File
@@ -68,6 +68,7 @@ import {
getDefaultPaths, getDefaultPaths,
getRcloneVersion, getRcloneVersion,
} from '../../lib/rclone/common' } from '../../lib/rclone/common'
import { DOUBLE_BACKSLASH_REGEX } from '../../lib/rclone/constants'
import { usePersistedStore, useStore } from '../../lib/store' import { usePersistedStore, useStore } from '../../lib/store'
import { triggerTrayRebuild } from '../../lib/tray' import { triggerTrayRebuild } from '../../lib/tray'
import ConfigCreateDrawer from '../components/ConfigCreateDrawer' import ConfigCreateDrawer from '../components/ConfigCreateDrawer'
@@ -847,6 +848,7 @@ function RemotesSection() {
color="primary" color="primary"
data-focus-visible="false" data-focus-visible="false"
variant="shadow" variant="shadow"
size="lg"
> >
Create Remote Create Remote
</Button> </Button>
@@ -1329,12 +1331,13 @@ function AboutSection() {
const defaultPaths = await getDefaultPaths() const defaultPaths = await getDefaultPaths()
const version = await getVersion() const version = await getVersion()
const dirs = { const dirs = {
home: await homeDir(), // replace ALL (not just one) double backslashes with a single backslash
appLocalData: await appLocalDataDir(), home: (await homeDir()).replace(DOUBLE_BACKSLASH_REGEX, '\\'),
temp: await tempDir(), appLocalData: (await appLocalDataDir()).replace(DOUBLE_BACKSLASH_REGEX, '\\'),
appLog: await appLogDir(), temp: (await tempDir()).replace(DOUBLE_BACKSLASH_REGEX, '\\'),
download: await downloadDir(), appLog: (await appLogDir()).replace(DOUBLE_BACKSLASH_REGEX, '\\'),
appData: await appDataDir(), download: (await downloadDir()).replace(DOUBLE_BACKSLASH_REGEX, '\\'),
appData: (await appDataDir()).replace(DOUBLE_BACKSLASH_REGEX, '\\'),
} }
return { return {
versions: { versions: {
@@ -1478,12 +1481,16 @@ ${last30Lines.join('\n')}
value={JSON.stringify(info, null, 2)} value={JSON.stringify(info, null, 2)}
size="lg" size="lg"
label="Debug" label="Debug"
minRows={39} minRows={40}
maxRows={39} maxRows={40}
disableAutosize={false} disableAutosize={false}
isReadOnly={false} isReadOnly={false}
variant="faded" variant="faded"
className="pb-10" className="pb-10"
autoCapitalize="false"
autoComplete="false"
autoCorrect="false"
spellCheck="false"
/> />
</div> </div>
)} )}