Merge pull request #2364 from ethereum/migrate_file_system

Migrate file system to using BrowserFS
pull/5370/head
yann300 5 years ago committed by GitHub
commit aab8c23eb7
  1. 7
      src/app.js
  2. 18
      src/migrateFileSystem.js

@ -49,6 +49,8 @@ import { LandingPage } from './app/ui/landing-page/landing-page'
import { MainPanel } from './app/components/main-panel'
import { UniversalDApp } from 'remix-lib'
import migrateFileSystem from './migrateFileSystem'
var css = csjs`
html { box-sizing: border-box; }
*, *:before, *:after { box-sizing: inherit; }
@ -102,7 +104,6 @@ class App {
var self = this
self._components = {}
// setup storage
var fileStorage = new Storage('sol:')
var configStorage = new Storage('config-v0.8:')
// load app config
@ -111,7 +112,7 @@ class App {
// load file system
self._components.filesProviders = {}
self._components.filesProviders['browser'] = new FileProvider('browser', fileStorage)
self._components.filesProviders['browser'] = new FileProvider('browser')
registry.put({api: self._components.filesProviders['browser'], name: 'fileproviders/browser'})
var remixd = new Remixd(65520)
@ -125,6 +126,8 @@ class App {
registry.put({api: self._components.filesProviders, name: 'fileproviders'})
self._view = {}
migrateFileSystem(self._components.filesProviders['browser'])
}
init () {

@ -0,0 +1,18 @@
import { Storage } from 'remix-lib'
/*
Migrating the files to the BrowserFS storage instead or raw localstorage
*/
export default (fileProvider) => {
const fileStorage = new Storage('sol:')
if (fileStorage.keys().length === 0) return
fileStorage.keys().forEach((path) => {
if (path !== '.remix.config') {
const content = fileStorage.get(path)
fileProvider.set(path, content)
fileStorage.remove(path)
console.log('file migrated', path)
}
})
}
Loading…
Cancel
Save