castro.js
function(path) {
        // TODO: Does file exist at the file location path? If so, do something about it...
        //var defaultManager = $.NSFileManager('alloc')('init')
        //if (defaultManager('fileExistsAtPath',NSlocation)) {
        //    console.log("File already exists!")
        //}

        if (!path){
            // Default Destination: e.g. "/Users/hugs/Desktop/Castro_uul3di.mov"
            var homeDir =  $.NSHomeDirectory();
            var desktopDir = homeDir.toString() + '/Desktop/';
            var randomString = (Math.random() + 1).toString(36).substring(12);
            var filename = 'Castro_' + randomString + '.mp4';
            this.location = desktopDir + filename;
        } else {
            // TODO: Make sure path is legit.
            this.location = path;
        }
        this.NSlocation = $.NSString('stringWithUTF8String', this.location);
        this.NSlocationURL = $.NSURL('fileURLWithPath', this.NSlocation);
    }
function(path) {
        // TODO: Does file exist at the file location path? If so, do something about it...
        //var defaultManager = $.NSFileManager('alloc')('init')
        //if (defaultManager('fileExistsAtPath',NSlocation)) {
        //    console.log("File already exists!")
        //}

        if (!path){
            // Default Destination: e.g. "/Users/hugs/Desktop/Castro_uul3di.mov"
            var homeDir =  $.NSHomeDirectory();
            var desktopDir = homeDir.toString() + '/Desktop/';
            var randomString = (Math.random() + 1).toString(36).substring(12);
            var filename = 'Castro_' + randomString + '.mp4';
            this.location = desktopDir + filename;
        } else {
            // TODO: Make sure path is legit.
            this.location = path;
        }
        this.NSlocation = $.NSString('stringWithUTF8String', this.location);
        this.NSlocationURL = $.NSURL('fileURLWithPath', this.NSlocation);
    }
function ( path ) { // TODO: Does file exist at the file location path? If so, do something about it... //var defaultManager = $.NSFileManager('alloc')('init') //if (defaultManager('fileExistsAtPath',NSlocation)) { //    console.log("File already exists!") //} if ( ! path ) { // Default Destination: e.g. "/Users/hugs/Desktop/Castro_uul3di.mov" var homeDir = $ . NSHomeDirectory ( ) ; var desktopDir = homeDir . toString ( ) + '/Desktop/' ; var randomString = ( Math . random ( ) + 1 ) . toString ( 36 ) . substring ( 12 ) ; var filename = 'Castro_' + randomString + '.mp4' ; this . location = desktopDir + filename ; } else { // TODO: Make sure path is legit. this . location = path ; } this . NSlocation = $ . NSString ( 'stringWithUTF8String' , this . location ) ; this . NSlocationURL = $ . NSURL ( 'fileURLWithPath' , this . NSlocation ) ; }
Set recording file location
Set recording file location