     var inputFilenames = Process.arguments
     inputFilenames.removeAtIndex(0)
     
-    var filePathsArr = Array<String>()
+    var filePathsArr = Array<NSURL>()
     
     for filename in inputFilenames
     {
-        if filename[0] == "/" {
-            filePathsArr.append(filename)
+        if filename.characters[filename.startIndex.advancedBy(0)]  == "/" {
+            filePathsArr.append(NSURL.fileURLWithPath(filename))
             continue
         }
         
-        if filename[0] == "~" {
-            filePathsArr.append(filename.stringByExpandingTildeInPath)
+        if filename.characters[filename.startIndex.advancedBy(0)]  == "~" {
+            filePathsArr.append(NSURL.fileURLWithPath(filename))
             continue
         }
         

        let fileUrl = NSURL(string: filename, relativeToURL: NSURL(fileURLWithPath: currentPath))
        if let u = fileUrl {
            if let p = u.path {
                filePathsArr.append(p)
            }
        }
    }

import Foundation

let currentPath = NSFileManager.defaultManager().currentDirectoryPath
let defaultSourceIconPath = NSURL.fileURLWithPath(currentPath).URLByAppendingPathComponent("icon.png")
let iconResolutions = [29, 40, 48, 50, 55, 57, 58, 60, 72, 76, 80, 87, 88, 100, 114, 120, 144, 152, 167, 171, 172, 180, 196]

func outputDirPathForIconPath(iconPath: NSURL) -> NSURL
{
    let a = iconPath.URLByDeletingPathExtension?.lastPathComponent
    let b = iconPath.URLByDeletingLastPathComponent
    let c = b!.URLByAppendingPathComponent("\(a!)_output")
    return c
}

func scaleIcon(iconPath: NSURL, resolution: Int)
{
    let task = NSTask()
    task.launchPath = "/usr/bin/sips"
    task.arguments = ["-Z", "\(resolution)", iconPath.path!]
    task.launch()
}

func createIconsForFilePaths(filePaths : Array<NSURL>)
{
    var failedInputsCheck = false
    for filePath in filePaths
    {
        if NSFileManager.defaultManager().fileExistsAtPath(filePath.path!) == false {
            failedInputsCheck = true
            print("Issue: file does not exist \(filePath)")
        }
        
        if NSFileManager.defaultManager().fileExistsAtPath(outputDirPathForIconPath(filePath).absoluteString) {
            failedInputsCheck = true
            print("Issue: this directory exists and will be re-written \(outputDirPathForIconPath(filePath))")
        }
    }
    
