rdesktop2
filip mertens 1 year ago
parent a2dc8b996a
commit 867b9775c0
  1. 2
      apps/remix-ide/src/app/files/fileProvider.js
  2. 1
      apps/remix-ide/src/app/files/remixDProvider.js
  3. 10
      apps/remix-ide/src/app/plugins/electron/fsPlugin.ts

@ -286,14 +286,12 @@ export class FileProvider {
if (path.indexOf('/') !== 0) path = '/' + path if (path.indexOf('/') !== 0) path = '/' + path
try { try {
const files = await window.remixFileSystem.readdir(path) const files = await window.remixFileSystem.readdir(path)
console.log('files resolveDirectory', files)
const ret = {} const ret = {}
if (files) { if (files) {
for (let element of files) { for (let element of files) {
path = path.replace(/^\/|\/$/g, '') // remove first and last slash path = path.replace(/^\/|\/$/g, '') // remove first and last slash
element = element.replace(/^\/|\/$/g, '') // remove first and last slash element = element.replace(/^\/|\/$/g, '') // remove first and last slash
const absPath = (path === '/' ? '' : path) + '/' + element const absPath = (path === '/' ? '' : path) + '/' + element
console.log(absPath, 'absPath')
ret[absPath.indexOf('/') === 0 ? absPath.substr(1, absPath.length) : absPath] = { isDirectory: (await window.remixFileSystem.stat(absPath)).isDirectory() } ret[absPath.indexOf('/') === 0 ? absPath.substr(1, absPath.length) : absPath] = { isDirectory: (await window.remixFileSystem.stat(absPath)).isDirectory() }
// ^ ret does not accept path starting with '/' // ^ ret does not accept path starting with '/'
} }

@ -26,7 +26,6 @@ module.exports = class RemixDProvider extends FileProvider {
}) })
this._appManager.on('remixd', 'fileAdded', (path) => { this._appManager.on('remixd', 'fileAdded', (path) => {
console.log('fileAdded remixd', path)
this.event.emit('fileAdded', path) this.event.emit('fileAdded', path)
}) })

@ -46,9 +46,7 @@ export class fsPlugin extends ElectronPlugin {
}, },
readdir: async (path: string) => { readdir: async (path: string) => {
path = fixPath(path) path = fixPath(path)
//console.log('readdir', path)
const files = await this.call('fs', 'readdir', path) const files = await this.call('fs', 'readdir', path)
//console.log('readdir', path, files)
return files return files
}, },
glob: async (path: string, pattern: string, options?: any) => { glob: async (path: string, pattern: string, options?: any) => {
@ -66,13 +64,10 @@ export class fsPlugin extends ElectronPlugin {
}, },
readFile: async (path: string, options) => { readFile: async (path: string, options) => {
try { try {
//console.log('readFile', path, options)
path = fixPath(path) path = fixPath(path)
const file = await this.call('fs', 'readFile', path, options) const file = await this.call('fs', 'readFile', path, options)
//console.log('readFile', path, file)
return file return file
} catch (e) { } catch (e) {
//console.log('readFile error', e)
return undefined return undefined
} }
} }
@ -94,7 +89,6 @@ export class fsPlugin extends ElectronPlugin {
stat.isFile = () => !stat.isDirectoryValue stat.isFile = () => !stat.isDirectoryValue
return stat return stat
} catch (e) { } catch (e) {
//console.log('stat error', e)
return undefined return undefined
} }
}, },
@ -107,7 +101,6 @@ export class fsPlugin extends ElectronPlugin {
stat.isFile = () => !stat.isDirectoryValue stat.isFile = () => !stat.isDirectoryValue
return stat return stat
} catch (e) { } catch (e) {
//console.log('lstat error', e)
return undefined return undefined
} }
}, },
@ -137,12 +130,11 @@ export class fsPlugin extends ElectronPlugin {
async onActivation() { async onActivation() {
//console.log('fsPluginClient onload', this.fs);
(window as any).remixFileSystem = this.fs; (window as any).remixFileSystem = this.fs;
this.on('fs', 'workingDirChanged', async (path: string) => { this.on('fs', 'workingDirChanged', async (path: string) => {
//console.log('change working dir', path)
workingDir = path workingDir = path
await this.call('fileManager', 'refresh') await this.call('fileManager', 'refresh')
}) })

Loading…
Cancel
Save