rdesktop^2
filip mertens 1 year ago
parent f275f0ae8a
commit 171518f49a
  1. 26
      apps/1test/src/electron/fsPlugin.ts
  2. 6
      apps/1test/src/renderer.ts

@ -1,8 +1,9 @@
import { PluginClient } from "@remixproject/plugin";
import { createClient } from "./electronPluginClient"
import { Engine, PluginManager, Plugin } from '@remixproject/engine';
import fs from 'fs'
import { existsSync } from "fs-extra";
import fs from 'fs/promises'
import { Stats } from "fs";
const profile = {
displayName: 'fs',
@ -34,39 +35,36 @@ class FSPluginClient extends PluginClient {
async readdir(path: string): Promise<string[]> {
// call node fs.readdir
return fs.readdirSync(path)
return fs.readdir(path)
}
async readFile(path: string): Promise<string> {
return fs.readFileSync(path, 'utf8')
return fs.readFile(path, 'utf8')
}
async writeFile(path: string, content: string): Promise<void> {
return fs.writeFileSync(path, content, 'utf8')
return fs.writeFile(path, content, 'utf8')
}
async mkdir(path: string): Promise<void> {
return fs.mkdirSync(path)
return fs.mkdir(path)
}
async rmdir(path: string): Promise<void> {
return fs.rmdirSync(path)
return fs.rmdir(path)
}
async unlink(path: string): Promise<void> {
return fs.unlinkSync(path)
return fs.unlink(path)
}
async rename(oldPath: string, newPath: string): Promise<void> {
return fs.renameSync(oldPath, newPath)
return fs.rename(oldPath, newPath)
}
async stat(path: string): Promise<fs.Stats> {
return fs.statSync(path)
async stat(path: string): Promise<Stats> {
return fs.stat(path)
}
async exists(path: string): Promise<boolean> {
return existsSync(path)
}
}

@ -13,12 +13,12 @@ const git = new gitPlugin()
engine.register(appManager)
engine.register(fs)
engine.register(git)
//appManager.activatePlugin('fs')
appManager.activatePlugin('fs')
appManager.activatePlugin('git')
setTimeout(async () => {
//const files = await appManager.call('fs', 'readdir', './')
//console.log('files', files)
const files = await appManager.call('fs', 'readdir', './')
console.log('files', files)
const log = await appManager.call('git', 'log', './')
console.log('log', log)
}, 5000)

Loading…
Cancel
Save