diff --git a/apps/remix-ide-e2e/src/tests/fileManager_api.spec.ts b/apps/remix-ide-e2e/src/tests/fileManager_api.spec.ts index ec4af936d0..26a49d9beb 100644 --- a/apps/remix-ide-e2e/src/tests/fileManager_api.spec.ts +++ b/apps/remix-ide-e2e/src/tests/fileManager_api.spec.ts @@ -147,8 +147,8 @@ const executeReadFile = ` const executeCopyFile = ` const run = async () => { - await remix.call('fileManager', 'copyFile', 'contracts/3_Ballot.sol', '/', 'new_contract.sol') - const result = await remix.call('fileManager', 'readFile', 'new_contract.sol') + await remix.call('fileManager', 'copyFile', 'contracts/3_Ballot.sol', '/', 'copy_contract.sol') + const result = await remix.call('fileManager', 'readFile', 'copy_contract.sol') console.log(result) } diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js index 8e05410e85..de0f01d541 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.js @@ -29,6 +29,7 @@ const { OffsetToLineColumnConverter } = require('./lib/offsetToLineColumnConvert const QueryParams = require('./lib/query-params') const Storage = remixLib.Storage const RemixDProvider = require('./app/files/remixDProvider') +const HardhatProvider = require('./app/tabs/hardhat-provider') const Config = require('./config') const modalDialogCustom = require('./app/ui/modal-dialog-custom') const modalDialog = require('./app/ui/modaldialog') @@ -277,6 +278,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org const networkModule = new NetworkModule(blockchain) // ----------------- represent the current selected web3 provider ---- const web3Provider = new Web3ProviderModule(blockchain) + const hardhatProvider = new HardhatProvider(blockchain) // ----------------- convert offset to line/column service ----------- const offsetToLineColumnConverter = new OffsetToLineColumnConverter() registry.put({ api: offsetToLineColumnConverter, name: 'offsettolinecolumnconverter' }) @@ -313,7 +315,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org terminal, web3Provider, fetchAndCompile, - dGitProvider + dGitProvider, + hardhatProvider ]) // LAYOUT & SYSTEM VIEWS diff --git a/apps/remix-ide/src/app/files/fileManager.js b/apps/remix-ide/src/app/files/fileManager.js index 1375a28ca8..9342c21405 100644 --- a/apps/remix-ide/src/app/files/fileManager.js +++ b/apps/remix-ide/src/app/files/fileManager.js @@ -232,9 +232,10 @@ class FileManager extends Plugin { await this._handleExists(dest, `Cannot paste content into ${dest}. Path does not exist.`) await this._handleIsDir(dest, `Cannot paste content into ${dest}. Path is not directory.`) const content = await this.readFile(src) - const copiedFileName = customName ? '/' + customName : '/' + `Copy_${helper.extractNameFromKey(src)}` + let copiedFilePath = dest + (customName ? '/' + customName : '/' + `Copy_${helper.extractNameFromKey(src)}`) + copiedFilePath = await helper.createNonClashingNameAsync(copiedFilePath, this) - await this.writeFile(dest + copiedFileName, content) + await this.writeFile(copiedFilePath, content) } catch (e) { throw new Error(e) } @@ -262,7 +263,8 @@ class FileManager extends Plugin { async inDepthCopy (src, dest, count = 0) { const content = await this.readdir(src) - const copiedFolderPath = count === 0 ? dest + '/' + `Copy_${helper.extractNameFromKey(src)}` : dest + '/' + helper.extractNameFromKey(src) + let copiedFolderPath = count === 0 ? dest + '/' + `Copy_${helper.extractNameFromKey(src)}` : dest + '/' + helper.extractNameFromKey(src) + copiedFolderPath = await helper.createNonClashingDirNameAsync(copiedFolderPath, this) await this.mkdir(copiedFolderPath) diff --git a/apps/remix-ide/src/app/files/remixd-handle.js b/apps/remix-ide/src/app/files/remixd-handle.js index a2d94eb3ea..679a27ce9a 100644 --- a/apps/remix-ide/src/app/files/remixd-handle.js +++ b/apps/remix-ide/src/app/files/remixd-handle.js @@ -4,6 +4,7 @@ import * as packageJson from '../../../../../package.json' var yo = require('yo-yo') var modalDialog = require('../ui/modaldialog') var modalDialogCustom = require('../ui/modal-dialog-custom') +var copyToClipboard = require('../ui/copy-to-clipboard') var csjs = require('csjs-inject') @@ -130,22 +131,27 @@ export class RemixdHandle extends WebsocketPlugin { } function remixdDialog () { + const commandText = 'remixd -s absolute-path-to-the-shared-folder --remix-ide your-remix-ide-URL-instance' return yo`