Skip to content

Commit

Permalink
fix Windows folder drop feature (#207)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hiroMTB authored and arturoc committed May 30, 2019
1 parent 3e6223b commit 6b36107
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions frontend/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -723,8 +723,9 @@ function onDropFile( e ){
var files = e.originalEvent.dataTransfer.files;
// import single project folder
$("#projectName").val( files[0].name );
var regExp = new RegExp("\\b/"+files[0].name+"\\b","gi");
$("#projectPath").val( files[0].path.replace(regExp,"") ).triggerHandler('change');
var projectFullPath = files[0].path;
var projectParentPath = path.normalize(projectFullPath+'/..');
$("#projectPath").val( projectParentPath ).triggerHandler('change');

$("createMenuButon").triggerHandler('click');
}
Expand Down

0 comments on commit 6b36107

Please sign in to comment.