@@ -105,17 +105,20 @@ module.exports = class Filepanel extends ViewPlugin {
105105
106106 refreshWorkspacesList ( ) {
107107 if ( ! document . getElementById ( 'workspacesSelect' ) ) return
108- this . _deps . fileProviders . browser . resolveDirectory ( '/' , ( error , fileTree ) => {
108+ this . _deps . fileProviders . browser . resolveDirectory ( '/.workspaces ' , ( error , fileTree ) => {
109109 if ( error ) console . error ( error )
110110 const items = fileTree
111111 items [ this . LOCALHOST ] = { isLocalHost : true }
112112 ReactDOM . render (
113113 (
114114 Object . keys ( items )
115115 . filter ( ( item ) => fileTree [ item ] . isDirectory || fileTree [ item ] . isLocalHost )
116- . map ( ( folder ) => < option selected = { this . currentWorkspace === folder } value = { folder } > { folder } </ option > ) ) , document . getElementById ( 'workspacesSelect' )
116+ . map ( ( folder ) => {
117+ folder = folder . replace ( '.workspaces/' , '' )
118+ return < option selected = { this . currentWorkspace === folder } value = { folder } > { folder } </ option >
119+ } ) ) , document . getElementById ( 'workspacesSelect' )
117120 )
118- if ( ! this . currentWorkspace ) this . setWorkspace ( Object . keys ( fileTree ) [ 0 ] )
121+ if ( ! this . currentWorkspace ) this . setWorkspace ( Object . keys ( fileTree ) [ 0 ] . replace ( '.workspaces/' , '' ) )
119122 } )
120123 }
121124
@@ -149,12 +152,11 @@ module.exports = class Filepanel extends ViewPlugin {
149152 }
150153
151154 setWorkspace ( name ) {
155+ this . currentWorkspace = name
152156 if ( name === this . LOCALHOST ) {
153- this . currentWorkspace = name
154157 this . call ( 'manager' , 'activatePlugin' , 'remixd' )
155158 } else {
156159 this . _deps . fileProviders . workspace . setWorkspace ( name )
157- this . currentWorkspace = name
158160 this . call ( 'manager' , 'deactivatePlugin' , 'remixd' )
159161 }
160162 this . renderComponent ( )
@@ -176,7 +178,7 @@ module.exports = class Filepanel extends ViewPlugin {
176178
177179 renameWorkspace ( ) {
178180 modalDialog . prompt ( 'Rename Workspace' , 'Please choose a name for the workspace' , this . currentWorkspace , async ( value ) => {
179- await this . _deps . fileManager . rename ( 'browser/' + this . currentWorkspace , 'browser/' + value )
181+ await this . _deps . fileManager . rename ( 'browser/.workspaces/ ' + this . currentWorkspace , 'browser/workspaces /' + value )
180182 setTimeout ( async ( ) => {
181183 this . setWorkspace ( value )
182184 } , 2000 )
@@ -186,7 +188,7 @@ module.exports = class Filepanel extends ViewPlugin {
186188 async createWorkspace ( ) {
187189 const workspace = `workspace_${ Date . now ( ) } `
188190 modalDialog . prompt ( 'New Workspace' , 'Please choose a name for the workspace' , workspace , ( value ) => {
189- this . _deps . fileProviders . browser . createDir ( value , async ( ) => {
191+ this . _deps . fileProviders . browser . createDir ( '.workspaces/' + value , async ( ) => {
190192 this . setWorkspace ( value )
191193 setTimeout ( async ( ) => {
192194 for ( const file in examples ) {
@@ -200,7 +202,7 @@ module.exports = class Filepanel extends ViewPlugin {
200202 deleteCurrentWorkspace ( ) {
201203 if ( ! this . currentWorkspace ) return
202204 modalDialog . confirm ( 'Delete Workspace' , 'Please confirm workspace deletion' , ( ) => {
203- this . _deps . fileProviders . browser . remove ( this . currentWorkspace )
205+ this . _deps . fileProviders . browser . remove ( '.workspaces/' + this . currentWorkspace )
204206 this . currentWorkspace = null
205207 this . renderComponent ( )
206208 } )
0 commit comments