Really easy question

I know this is really easy

I want to get the absolute path for the current app

And I can achieve using

String(reflecting: Bundle.main.bundleURL)

But what outputs isn't like /User/***/.....

but file:///User/xx/...

so

what can I do to get a absolute path in /***/***/*** format?

thanks

Answered by makabaka1880 in 717231022

OK I find out how

var appPath: String = String(reflecting: Bundle.main.bundleURL)
for i in 1...7 {
    appPath.removeFirst()
}

Hope it helps

Accepted Answer

OK I find out how

var appPath: String = String(reflecting: Bundle.main.bundleURL)
for i in 1...7 {
    appPath.removeFirst()
}

Hope it helps

Really easy question
 
 
Q