We’re trying to create a sales application that can dynamically display salesman’s powerpoint presentation files using the host default application.
I can get it to work on both html5 and cpp when the filename or path doesn’t have any spaces, but on cpp if the filename has a space it fails.
Ive tried using StringTools.quoteWinArg, but it adds a trailing backslash that I can’t seem to get rid of, and doesn’t show in the trace.
The file name for testing is defined as targetName = “user/presentation/SALES PRESENTATION.pptx”
I’ve also tried breaking it down and joining the elements, but the space always causes a problem.
On html5 this works no problem…
System.openFile(targetName);
But not on CPP, so far I have
#if (cpp || neko || windows || mac)
import haxe.io.Path;
import sys.FileSystem;
import sys.io.File;
import hx.strings.Paths;
import hx.strings.Strings;
#end
var pathtoFile:String = haxe.io.Path.join([Path.directory(Sys.programPath()), targetName]);
var dirName:String = Paths.dirname(pathtoFile);
var stripName:String = Paths.basename(targetName);
var normPath1:String = Paths.normalize(dirName, WIN);
var normPath2:String = Path.join([normPath1, stripName]);
var normPath3:String = StringTools.quoteWinArg(normPath2, false);
System.openFile(normPath3);