     
     // MARK: - Utils
     static func currentDirectoryPath(from candidate: String) -> String? {
-        guard let valid_url = URL(string: candidate) else {
-            return nil
-        }
-        let pathComponents: [String] = valid_url.pathComponents
-        let folderPath: String
-        let fm = FileManager.default
-        if fm.fileExists(atPath: valid_url.absoluteString) {
-            folderPath = "/\(pathComponents[1..<pathComponents.count-1].joined(separator: "/"))"
-        }
-        else {
-            folderPath = "/\(pathComponents[1..<pathComponents.count].joined(separator: "/"))"
-        }
-        return folderPath
+        return WriterUtils.directoryPath(from: candidate)
     }
     
     static func writeToFile(_ candidate: String) {

            print(message)
            return
        }
        let fm = FileManager.default
        if !fm.fileExists(atPath: valid_logFilePath) {
            do {
                try "".write(toFile: valid_logFilePath, atomically: true, encoding: String.Encoding.utf8)
            }
            catch {
                print("error:\(error)")
            }
        }
        guard fm.isWritableFile(atPath: valid_logFilePath) else {
            return
        }
        guard let valid_fileHandle = FileHandle(forWritingAtPath: valid_logFilePath) else {
            let message: String = "Unable to obtain valid \(String(describing: FileHandle.self)) object!"
            print(message)
            return
        }
        let stringToWrite = "\(candidate)\n"
        valid_fileHandle.seekToEndOfFile()
        
        guard let valid_data: Data = stringToWrite.data(using: String.Encoding.utf8) else {
            let message: String = "Unable to obtain valid \(String(describing: Data.self)) object from candidate=\(stringToWrite)!"
            print(message)
            return
        }
        valid_fileHandle.write(valid_data)
        valid_fileHandle.closeFile()
        
        SingleFileLogWriterImpl.cleanUpIfNeeded()
    }
    
    fileprivate static func createLogsDirecotry(at path: String) {
        guard !SingleFileLogWriterImpl.didCreateLogsDirectory else {
            return
        }
        
        let fm: FileManager = FileManager.default
        if !fm.fileExists(atPath: path) {
            do {
                try fm.createDirectory(atPath: path, withIntermediateDirectories: false, attributes: nil)
                SingleFileLogWriterImpl.didCreateLogsDirectory = true
            }
            catch {
                print("error:\(error)")
            }
        }
        else {
            SingleFileLogWriterImpl.didCreateLogsDirectory = true
        }
    }
    
    fileprivate static func logFilePath() -> String? {

    fileprivate static var logsDirectoryPath: String = ""
    static func update_logsDirectoryPath(_ newValue: String) {
        SingleFileLogWriterImpl.logsDirectoryPath = newValue
        guard SingleFileLogWriterImpl.logsDirectoryPath.count > 0 else {
            return
        }
        SingleFileLogWriterImpl.createLogsDirectory(at: self.logsDirectoryPath)
    }
    
    fileprivate static var logFileName: String = Constants.logFileDefaultName
