Skip to content

Commit 87a3485

Browse files
committed
add quotes to path with spaces fix #48, update help text
1 parent 5c92d65 commit 87a3485

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

MainWindow.xaml.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace PointCloudConverter
2929
{
3030
public partial class MainWindow : Window
3131
{
32-
static readonly string version = "21.03.2025";
32+
static readonly string version = "29.03.2025";
3333
static readonly string appname = "PointCloud Converter - " + version;
3434
static readonly string rootFolder = AppDomain.CurrentDomain.BaseDirectory;
3535

@@ -1083,7 +1083,14 @@ void StartProcess(bool doProcess = true)
10831083
var args = new List<string>();
10841084

10851085
// add enabled args to list, TODO use binding later?
1086-
args.Add("-input=" + txtInputFile.Text);
1086+
string inputFile = txtInputFile.Text;
1087+
string outputFile = txtOutput.Text;
1088+
1089+
// add quotes, if contains space in path
1090+
if (inputFile.Contains(" ")) inputFile = "\"" + inputFile + "\"";
1091+
if (outputFile.Contains(" ")) outputFile = "\"" + outputFile + "\"";
1092+
1093+
args.Add("-input=" + inputFile);
10871094

10881095
if (cmbImportFormat.SelectedItem != null)
10891096
{
@@ -1093,7 +1100,8 @@ void StartProcess(bool doProcess = true)
10931100
{
10941101
args.Add("-exportformat=" + cmbExportFormat.SelectedItem.ToString());
10951102
}
1096-
args.Add("-output=" + txtOutput.Text);
1103+
1104+
args.Add("-output=" + outputFile);
10971105

10981106
// check if using autooffset
10991107
//if ((bool)chkAutoOffset.IsChecked && !(bool)chkManualOffset.IsChecked)

Tools/ArgParser.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@ public static ImportSettings Parse(string[] args, string rootFolder, ILogger log
216216
case "-input":
217217
Log.Write("input = " + param);
218218

219+
// remove quotes (needed for paths with spaces)
220+
param = param.Trim('"');
221+
219222
// if relative folder, FIXME this fails on -input="C:\asdf\etryj\folder\" -importformat=las because backslash in \", apparently this https://stackoverflow.com/a/9288040/5452781
220223
if (Path.IsPathRooted(param) == false)
221224
{
@@ -761,7 +764,7 @@ public static ImportSettings Parse(string[] args, string rootFolder, ILogger log
761764
if (filterDistValue == false || tempFloat <= 0f)
762765

763766
{
764-
importSettings.errors.Add("Invalid filter value: " + param);
767+
importSettings.errors.Add("Invalid filter value (must be greater than 0) : " + param);
765768
}
766769
else
767770
{

Tools/Tools.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ public static void PrintHelpAndExit(char argSeparator, bool waitEnter = false)
354354
Console.WriteLine("-output" + argSeparator + "yourfile.ucpc\t(Default is same folder as input file. For v3 you dont need to set file extension)");
355355
Console.WriteLine("-rgb" + argSeparator + "true or false\tReads RGB colors\tDefault is true");
356356
Console.WriteLine("-intensity" + argSeparator + "true or false\tReads Intensity as RGB color\tDefault is false");
357+
Console.WriteLine("-classification" + argSeparator + "false\t\tImport classification data\tDefault is false");
357358
Console.WriteLine("-offset" + argSeparator + "true or false\tAuto-offsets cloud near 0,0,0 by using the first point as offset value\tDefault is true");
358359
Console.WriteLine("-gridsize" + argSeparator + "5\t\tGridsize in meters, splits cloud into tiles with this size. v3 only!\tDefault is 5, minimum is 0.1 (Note: values below 1 are not really tested)");
359360
Console.WriteLine("-minpoints" + argSeparator + "1000\t\tIf tile has less points than this value, its discarded. Good for removing straypoints. v3 only!\tDefault is 1000");
@@ -364,6 +365,7 @@ public static void PrintHelpAndExit(char argSeparator, bool waitEnter = false)
364365
Console.WriteLine("-limit" + argSeparator + "10000\t\tLoad only this many points (good for testing settings first)\tDefault is off");
365366
Console.WriteLine("-skip" + argSeparator + "0\t\t\tSkip every Nth point (For reducing point count)\tDefault is off");
366367
Console.WriteLine("-keep" + argSeparator + "0\t\t\tKeep only every Nth point (For reducing point count)\tDefault is off");
368+
Console.WriteLine("-filter" + argSeparator + "0\t\t\tKeep only first point within this distance on world grid (In Unity units)\tDefault is off");
367369
Console.WriteLine("-maxfiles" + argSeparator + "10\t\t\tFor batch processing, parse only this many files (good for testing with few files first)\tDefault is parse all found files");
368370
// TODO Console.WriteLine("-decimate" + separator + "50\t\t\tRemoves 50% of the points (by skipping every x point)\tDefault is off");
369371
//Console.WriteLine("-version" + argSeparator + "2\t\t2=v2 .ucpc, 3=v3 .pcroot tiles\tDefault is 2");
@@ -378,6 +380,7 @@ public static void PrintHelpAndExit(char argSeparator, bool waitEnter = false)
378380
Console.WriteLine("-config" + argSeparator + "filename\t\tLoad arguments from text file (easier to handle separate settings for different projects)");
379381
Console.WriteLine("-usegrid" + argSeparator + "true\t\tSplits point cloud to grid (multiple files). Required for V3 format (automatically enabled if its off). \tDefault is true for v3");
380382
Console.WriteLine("-offsetmode" + argSeparator + "min\t\tGet auto-offset bounds, min=min from all bounds, legacy= first cloud min bounds\tDefault is min");
383+
381384
Console.WriteLine("");
382385
Console.WriteLine("? /? -? help -help /help");
383386
Console.ForegroundColor = ConsoleColor.White;

0 commit comments

Comments
 (0)