Get directory separator helper function

Post Reply
User avatar
gabrielp
Advanced member
Posts: 645
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Get directory separator helper function

Post by gabrielp » Tue Sep 06, 2016 8:50 pm

Simple function to determine directory separators.

Code: Select all

// Determine directory seperator
var getDirectorySeperator = function(s : Switch){
    var directorySeperator;
    if(s.isMac()){
        directorySeperator = '/';
    } else {
        directorySeperator = '\\'
    }
    return directorySeperator;
};

Code: Select all

var jobTicketPath = jobTicketFolder + getDirectorySeperator(s) + 'ticket.xml';
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

If I've helped you and you'd like to say thanks, consider adding me on LinkedIn and leaving me an endorsement or recommendation. It helps a lot!

Post Reply