Commit ec9c4748 authored by ioedeveloper's avatar ioedeveloper

Emit folder added event from plugin

parent dc911505
......@@ -8,7 +8,7 @@
},
"scripts": {
"test": "echo \"Error: no test specified\"",
"start": "./lib/bin/remixd.js",
"start": "./lib/bin/remixd.js -s ./shared --remix-ide http://127.0.0.1:8080",
"npip": "npip",
"lint": "eslint ./src --ext .ts",
"build": "tsc -p ./ && chmod +x ./lib/bin/remixd.js",
......
......@@ -94,7 +94,14 @@ export class RemixdClient extends PluginClient {
}
this.trackDownStreamUpdate[path] = path
if (isFolder) {
fs.mkdirp(path).then(() => resolve()).catch((e: Error) => reject(e))
fs.mkdirp(path).then(() => {
const splitPath = path.split('/')
splitPath.pop()
const parentDir = splitPath.join('/') + '/'
this.emit('folderAdded', parentDir)
resolve()
}).catch((e: Error) => reject(e))
} else {
fs.ensureFile(path).then(() => {
fs.writeFile(path, args.content, 'utf8', (error: Error) => {
......
......@@ -14,7 +14,9 @@ const pathModule = require('path')
*/
function absolutePath (path: string, sharedFolder:string): string {
path = normalizePath(path)
if (path.indexOf(sharedFolder) !== 0) {
const exists = fs.existsSync('/' + path)
if (!exists && path.indexOf(sharedFolder) !== 0) {
path = pathModule.resolve(sharedFolder, path)
}
return path
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment