rdesktop2
bunsenstraat 1 year ago
parent 34acdb76a1
commit 9b4b8970ae
  1. 12
      apps/remixdesktop/src/plugins/fsPlugin.ts

@ -7,6 +7,7 @@ import { createWindow, isPackaged } from "../main";
import { writeConfig } from "../utils/config"; import { writeConfig } from "../utils/config";
import { glob, GlobOptions } from 'glob' import { glob, GlobOptions } from 'glob'
import { Path } from 'path-scurry' import { Path } from 'path-scurry'
import path from "path";
const profile: Profile = { const profile: Profile = {
displayName: 'fs', displayName: 'fs',
@ -14,6 +15,11 @@ const profile: Profile = {
description: 'fs' description: 'fs'
} }
const convertPathToPosix = (pathName: string): string => {
return pathName.split(path.sep).join(path.posix.sep)
}
export class FSPlugin extends ElectronBasePlugin { export class FSPlugin extends ElectronBasePlugin {
clients: FSPluginClient[] = [] clients: FSPluginClient[] = []
constructor() { constructor() {
@ -116,7 +122,7 @@ class FSPluginClient extends ElectronBasePluginClient {
isDirectory isDirectory
}) })
} }
console.log('readdir', path, Date.now() - startTime) console.log('readdir', result, Date.now() - startTime)
return result return result
} }
@ -128,6 +134,7 @@ class FSPluginClient extends ElectronBasePluginClient {
withFileTypes: true, withFileTypes: true,
...options ...options
}) })
console.log('glob', files)
const result: any[] = [] const result: any[] = []
for (const file of files) { for (const file of files) {
@ -234,9 +241,12 @@ class FSPluginClient extends ElectronBasePluginClient {
'**/.git/**', '**/.git/**',
] ]
}).on('all', async (eventName, path, stats) => { }).on('all', async (eventName, path, stats) => {
console.log('change', eventName, path, stats) console.log('change', eventName, path, stats)
let pathWithoutPrefix = path.replace(this.workingDir, '') let pathWithoutPrefix = path.replace(this.workingDir, '')
pathWithoutPrefix = convertPathToPosix(pathWithoutPrefix)
if (pathWithoutPrefix.startsWith('/')) pathWithoutPrefix = pathWithoutPrefix.slice(1) if (pathWithoutPrefix.startsWith('/')) pathWithoutPrefix = pathWithoutPrefix.slice(1)
if (eventName === 'change') { if (eventName === 'change') {

Loading…
Cancel
Save