@@ -265,23 +265,31 @@ static bool InitOptions(string[] args)
265
265
options . Command = options . Command . Trim ( ) . ToUpper ( ) ;
266
266
}
267
267
268
+ // Path parameter is a file
269
+ if ( options != null && options . Path != null && options . Command == Command . CLAR_UPLOAD )
270
+ {
271
+ if ( File . Exists ( options . Path ) )
272
+ {
273
+ searchPattern = Path . GetFileName ( options . Path ) ;
274
+ options . Path = options . Path . Substring ( 0 , options . Path . Length - searchPattern . Length ) ;
275
+ }
276
+ }
277
+
268
278
// Set search pattern and cloud collection if parameters are included.
269
279
if ( options != null && options . Parameters != null )
270
280
{
271
281
switch ( options . Command )
272
282
{
273
- case Command . CLAR_UPLOAD :
283
+ case Command . CLAR_UPLOAD :
284
+ cloudCollection = options . Parameters ;
285
+ break ;
274
286
case Command . CLAR_DOWNLOAD :
275
- if ( options . Command == Command . CLAR_DOWNLOAD )
276
- {
277
- searchPattern = "" ;
278
- options . Parameters = Path . GetFileName ( Path . TrimEndingDirectorySeparator ( options . Parameters ) ) ;
279
- }
287
+ searchPattern = "" ;
288
+ options . Parameters = Path . GetFileName ( Path . TrimEndingDirectorySeparator ( options . Parameters ) ) ;
280
289
cloudCollection = options . Parameters ;
281
290
break ;
282
291
case Command . DRIVE_UPLOAD :
283
- case Command . DRIVE_TRASH :
284
-
292
+ case Command . DRIVE_TRASH :
285
293
searchPattern = options . Parameters ;
286
294
break ;
287
295
case Command . PHOTO_DOWNLOAD :
@@ -402,7 +410,10 @@ static void ParameterOption()
402
410
cloudCollection = Console . ReadLine ( ) . Trim ( ) ;
403
411
Console . WriteLine ( "" ) ;
404
412
options . Parameters = cloudCollection ;
405
- searchPattern = "*.clar" ;
413
+ if ( searchPattern . ToLower ( ) . IndexOf ( ".clar" ) < 0 )
414
+ {
415
+ searchPattern = "*.clar" ;
416
+ }
406
417
if ( options . Command == Command . CLAR_DOWNLOAD )
407
418
{
408
419
searchPattern = "" ;
0 commit comments