@@ -32,19 +32,35 @@ const saveOptions = [
3232 } ,
3333] ;
3434
35+ const DEFAULT_DIR = "uploads" ;
36+
3537const OverwriteModel = ( props ) => {
38+ const updateFullPath = ( value ) => {
39+ if ( value && value . startsWith ( '/' ) ) { // We know we will be in a UNIX like env.
40+ return value
41+ }
42+ Utils
43+ . evalPythonMessage ( 'netpyne_geppetto.getFullPath' , [ null , value ] )
44+ . then ( ( fullpath ) => {
45+ setDstPath ( `${ fullpath } /` )
46+ } )
47+ return DEFAULT_DIR
48+ }
49+
3650 const srcPath = useSelector ( ( state ) => state . general . modelPath ) ;
3751 const [ explorerDialogOpen , setExplorerDialogOpen ] = React . useState ( false ) ;
3852 const [ openOverwriteDialog , setOpenOverwriteDialog ] = React . useState ( false ) ;
3953 const [ isDirectoryValid , setIsDirectoryValid ] = React . useState ( false ) ;
4054 const [ explorerParameter , setExplorerParameter ] = React . useState ( 'srcPath' ) ;
41- const [ dstPath , setDstPath ] = React . useState ( srcPath ) ;
55+ const [ dstPath , setDstPath ] = React . useState ( srcPath ? srcPath : DEFAULT_DIR ) ;
4256 const [ options , setOptions ] = React . useState ( {
4357 exportNetParamsAsPython : false ,
4458 exportSimConfigAsPython : false
4559 } ) ;
4660 const dispatch = useDispatch ( ) ;
4761
62+ updateFullPath ( dstPath ) ;
63+
4864 const getDirAndModuleFromPath = ( fullpath ) => {
4965 const fileName = fullpath . replace ( / ^ .* [ \\ / ] / , '' ) ;
5066 const moduleName = fileName . replace ( / \. [ ^ / . ] + $ / , '' ) ;
@@ -128,6 +144,8 @@ const OverwriteModel = (props) => {
128144 // We cleanup on close
129145 React . useEffect ( ( ) => { return ( ) => props . onRequestClose ( ) } , [ ] ) ;
130146
147+
148+
131149 return (
132150 < >
133151 < ActionValidationDialog
0 commit comments