Skip to content

Commit 6b36107

Browse files
hiroMTBarturoc
authored andcommitted
fix Windows folder drop feature (#207)
Windows returns path with forward slash, (e.g. \of\apps\mySketch) macOS and Linux returns path with back slash (e.g. /of/apps/mySketch) So RegExp can not find project name on Windows. Fixes #157
1 parent 3e6223b commit 6b36107

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

frontend/app.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -723,8 +723,9 @@ function onDropFile( e ){
723723
var files = e.originalEvent.dataTransfer.files;
724724
// import single project folder
725725
$("#projectName").val( files[0].name );
726-
var regExp = new RegExp("\\b/"+files[0].name+"\\b","gi");
727-
$("#projectPath").val( files[0].path.replace(regExp,"") ).triggerHandler('change');
726+
var projectFullPath = files[0].path;
727+
var projectParentPath = path.normalize(projectFullPath+'/..');
728+
$("#projectPath").val( projectParentPath ).triggerHandler('change');
728729

729730
$("createMenuButon").triggerHandler('click');
730731
}

0 commit comments

Comments
 (0)