rharder / imagesnap

Capture Images from the Command Line
https://github.com/rharder/imagesnap
458 stars 50 forks source link

Problem with paths starting with / or ~ #11

Closed KittyGiraudel closed 3 years ago

KittyGiraudel commented 9 years ago

This works:

imagesnap -w 3 "Documents/test.jpg"

This works:

imagesnap -w 3 "./Documents/test.jpg"

This doesn't:

imagesnap -w 3 "/Documents/test.jpg"

This doesn't:

imagesnap -w 3 "~/Documents/test.jpg"

Stacktrace:

No device specified. Using FaceTime HD Camera
Starting device...Starting capture session...
    Creating QTCaptureSession...Done.
    Creating QTCaptureDeviceInput with FaceTime HD Camera...Done.
    Creating QTCaptureDecompressedVideoOutput...Done.
    Entering synchronized block to clear memory...Done.
Session started.
Device started.
Skipping warmup period.
Taking snapshot...
..Snapshot taken.
Stopping session...
    CaptureSession != nil
    Stopping CaptureSession...Done.
    Shutting down 'stopSession(..)'Error.

It fails here:

// Image capture
if( [ImageSnap saveSingleSnapshotFrom:device toFile:filename withWarmup:warmup withTimelapse:timelapse] ){
    console( "%s\n", [filename UTF8String] );
} else {
    error( "Error.\n" );
}   // end else

Any idea? :)

danyshaanan commented 9 years ago

Try without the double quotes.

imagesnap -w 3 /Documents/test.jpg

and

imagesnap -w 3 ~/Documents/test.jpg

also, for the first example, make sure that /Documents/ exists and that you have permissions to write in it.