Find relative path

pull/1052/head
ioedeveloper 4 years ago
parent 306192ec66
commit b9f3b137b7
  1. 10
      apps/remix-ide/src/app/files/fileManager.js
  2. 2
      libs/remix-ui/file-explorer/src/lib/file-explorer.tsx

@ -9,6 +9,7 @@ const globalRegistry = require('../../global/registry')
const toaster = require('../ui/tooltip')
const modalDialogCustom = require('../ui/modal-dialog-custom')
const helper = require('../../lib/helper.js')
const path = require('path')
/*
attach to files event (removed renamed)
@ -58,7 +59,14 @@ class FileManager extends Plugin {
}
limitPluginScope (path) {
return path.replace(/^\/browser\//, '').replace(/^browser\//, '') // forbids plugin to access the root filesystem
const workspace = this.fileManager.currentWorkspace()
if (workspace) {
} else {
}
}
/**

@ -314,6 +314,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
const createNewFile = (newFilePath: string) => {
const fileManager = state.fileManager
if (helper.checkSpecialChars(newFilePath) || helper.checkSlash(newFilePath)) return toast('special characters are not allowed')
helper.createNonClashingName(newFilePath, filesProvider, async (error, newName) => {
if (error) {
modal('Create File Failed', error, {
@ -392,6 +393,7 @@ export const FileExplorer = (props: FileExplorerProps) => {
fn: () => {}
}, null)
} else {
if (helper.checkSpecialChars(newPath) || helper.checkSlash(newPath)) throw new Error('special characters are not allowed')
await fileManager.rename(oldPath, newPath)
}
} catch (error) {

Loading…
Cancel
Save