Fix for RemoteCmd capture command not handling spaces

Report bugs and errors to the digiCamControl development team.
Post Reply
bitbasher
Posts: 4
Joined: Tue Dec 05, 2017 11:31 pm

Fix for RemoteCmd capture command not handling spaces

Post by bitbasher » Tue Dec 05, 2017 11:38 pm

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!

Fix for RemoteCmd capture command not handling spaces

Advertisment
 

Post Reply