@@ -696,7 +696,7 @@ async function store(state, emitter) {
696
696
if ( file . type === 'folder' ) {
697
697
698
698
let serialPath = await serial . getFullPath ( '/' , state . boardNavigationPath , file . fileName )
699
- log ( 'deleteBoardFolder' , serialPath )
699
+ // log('deleteBoardFolder', serialPath)
700
700
await deleteBoardFolder ( serialPath )
701
701
await serial . createFolder ( serialPath )
702
702
const sourceDiskPath = disk . getFullPath ( state . diskNavigationRoot , state . diskNavigationPath , file . fileName )
@@ -705,7 +705,7 @@ async function store(state, emitter) {
705
705
const fsItem = uploadTree [ i ]
706
706
const strippedPath = fsItem . filePath . split ( sourceDiskPath ) [ 1 ]
707
707
let nestedSerialPath = serialPath + strippedPath
708
- if ( fsItem . type === 'dir ' ) {
708
+ if ( fsItem . type === 'folder ' ) {
709
709
await serial . createFolder ( nestedSerialPath )
710
710
} else {
711
711
const diskPath = fsItem . filePath
@@ -719,7 +719,6 @@ async function store(state, emitter) {
719
719
)
720
720
}
721
721
}
722
- const confirmAction = alert ( `Folder transfer not yet available` )
723
722
continue
724
723
}
725
724
await serial . uploadFile (
@@ -759,26 +758,34 @@ async function store(state, emitter) {
759
758
state . currentFSItem = file . fileName
760
759
emitter . emit ( 'render' )
761
760
const folder_path = serial . getFullPath ( '/' , state . boardNavigationPath , file . fileName )
761
+ // log('folder_path', folder_path)
762
762
let command = microPythonFShelpers
763
763
command += microPythonFileTree
764
764
command += `print_file_tree('${ folder_path } ')`
765
765
let output = await serial . run ( command )
766
+ // console.log(output)
766
767
output = extract ( output )
767
768
output = output . replace ( / ' / g, '"' )
768
769
output = output . split ( 'OK' )
769
770
let files = JSON . parse ( output )
771
+
772
+ // console.log(files)
770
773
for ( f in files ) {
771
774
const sourcePath = ( files [ f ] [ 1 ] )
772
775
const type = files [ f ] [ 3 ]
773
- const sourceRelativePath = sourcePath . split ( state . boardNavigationPath ) [ 1 ]
776
+ const strippedPath = sourcePath . slice ( sourcePath . indexOf ( state . boardNavigationPath ) + state . boardNavigationPath . length )
777
+ // console.log('sourcePath:', state.boardNavigationPath)
778
+ // console.log('strippedPath', sourcePath, strippedPath)
774
779
if ( type === 'folder' ) {
775
- const newFolderPath = disk . getFullPath ( state . diskNavigationRoot , state . diskNavigationPath , `/${ sourceRelativePath } ` )
776
- state . currentFSItem = file . fileName
780
+ const newFolderPath = disk . getFullPath ( state . diskNavigationRoot , state . diskNavigationPath , `${ strippedPath } ` )
781
+ // console.log('create new folder', sourcePath, newFolderPath)
782
+ state . currentFSItem = f . fileName
777
783
state . transferringProgress = null
778
784
emitter . emit ( 'render' )
779
785
await disk . createFolder ( newFolderPath )
780
786
} else {
781
- const fileDestinationPath = disk . getFullPath ( state . diskNavigationRoot , state . diskNavigationPath , `/${ sourceRelativePath } ` )
787
+ const fileDestinationPath = disk . getFullPath ( state . diskNavigationRoot , state . diskNavigationPath , `${ strippedPath } ` )
788
+ // console.log('download file', sourcePath, fileDestinationPath)
782
789
state . currentFSItem = file . fileName
783
790
state . transferringProgress = null
784
791
emitter . emit ( 'render' )
0 commit comments