Revision: 4685 http://sourceforge.net/p/vexi/code/4685 Author: mkpg2 Date: 2014-04-10 18:42:20 +0000 (Thu, 10 Apr 2014) Log Message: ----------- Support opening a directory in filexplorer, from only a string. - not a security issues as such (not really different to opening a file dialog) - however really to fully integrate with the local network environment/desktop we would probably need to have a flag set in the launcher at build time which gives access to do this.
Modified Paths: -------------- branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/plat/Desktop.java Added Paths: ----------- branches/vexi3/org.vexi-vexi.widgets/src_poke/poke/core/open_file_explorer.t Modified: branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/plat/Desktop.java =================================================================== --- branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/plat/Desktop.java 2014-04-04 16:07:43 UTC (rev 4684) +++ branches/vexi3/org.vexi-core.main/src/main/java/org/vexi/plat/Desktop.java 2014-04-10 18:42:20 UTC (rev 4685) @@ -56,7 +56,7 @@ return null; } if("open".equals(method)) { - desktop.open(expectFile(arg)); + desktop.open(expectFile(arg, true)); return null; } if("print".equals(method)) { @@ -79,11 +79,24 @@ } - static private File expectFile(JS arg) throws JSExn{ + static private File expectFile(JS arg) throws JSExn{ return expectFile(arg, false); } + static private File expectFile(JS arg, boolean acceptStringDir) throws JSExn{ Fountain f = JSU.getFountain(arg); if(f instanceof Fountain.File){ return new File(((Fountain.File)f).path); }else{ + // HACK really we SHOULD have a build flag in the which gives us an internet version + // (no direct access to the fs) and a local version which can better integrate with + // the local network environment. For now this is a compromise. Make it possible to + // open a directory, just given the path. + if(acceptStringDir && JSU.isString(arg)){ + File d = new File(JSU.toString(arg)); + if(d.isDirectory()){ + return d; + }else{ + throw new JSExn("Cannot open expected file fountain as argument: "+JSU.toString(arg)); + } + } throw new JSExn("Expected file fountain as argument: "+JSU.toString(arg)); } } Added: branches/vexi3/org.vexi-vexi.widgets/src_poke/poke/core/open_file_explorer.t =================================================================== --- branches/vexi3/org.vexi-vexi.widgets/src_poke/poke/core/open_file_explorer.t (rev 0) +++ branches/vexi3/org.vexi-vexi.widgets/src_poke/poke/core/open_file_explorer.t 2014-04-10 18:42:20 UTC (rev 4685) @@ -0,0 +1,18 @@ +<!-- public domain --> + +<vexi xmlns:ui="vexi://ui" xmlns:w="vexi.widget"> + <w:surface /> + <ui:box frameheight="100"> + <w:textfield id="url" text="c:/users/mike/" /> + <w:button id="launch" text="Browse Directory (or equivalent)" /> + + vexi.ui.frame = thisbox; + + $launch.action ++= function(v) { + vexi.log.info("browse directory: "+$url.text); + vexi.desktop.open($url.text); + return; + } + + </ui:box> +</vexi> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Put Bad Developers to Shame Dominate Development with Jenkins Continuous Integration Continuously Automate Build, Test & Deployment Start a new project now. Try Jenkins in the cloud. http://p.sf.net/sfu/13600_Cloudbees _______________________________________________ Vexi-svn mailing list Vexi-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vexi-svn