Page 1 of 1

Fix for RemoteCmd capture command not handling spaces

Posted: Tue Dec 05, 2017 11:38 pm
by bitbasher
The remote command:

CameraControlRemoteCmd /c capture "C:\ProgramData\My Stuff\auto cap\image.jpg"

Does not work because the path (or filename) contains spaces.

I've coded and tested a fix in CameraControl.Core\Scripting\CommandLineProcessor.cs that seems to work...

Code: Select all

        public object Pharse(string[] args)
        {
            var cmd = args[0].ToLower().Trim();
            switch (cmd)
            {
                case "capturenoaf":
                case "capture":
                    if (args.Length > 1 && !string.IsNullOrWhiteSpace(args[1]))
                    {
//                      var file = args[1];						// OLD
                        var file = string.Join(" ",args.Skip(1)).Trim();		// FIX
                        if (file.Contains(":\\") || file.StartsWith(@"\\"))
                        {
                            ServiceProvider.Settings.DefaultSession.Folder = Path.GetDirectoryName(file);
                            ServiceProvider.Settings.DefaultSession.FileNameTemplate = Path.GetFileNameWithoutExtension(file);
                        }
I've replaced the line marked OLD with the new line marked FIX. Could this be incorporated into the mainline code (after testing of course)?

Thanks!