Given let filename: String! = "file.ext", filename.split(".")[0] returns String, not String! which is understandable.
But I can't find a good way to construct a path from this:
let dirname = filename.split(".")[0]
Failing cases
let name: String! = "/work/" + dirname
# Doesn't turn dirname into String!
assert { dirname != null }
let name: String! = "/work/" + dirname
The best solution I found so far:
# Make sure it's actually non-nil
assert { dirname != null }
let name = ["/work", filename.split(".")[0]].join("/")
I might be missing something, but I couldn't find a better solution so far.
Given
let filename: String! = "file.ext",filename.split(".")[0]returnsString, notString!which is understandable.But I can't find a good way to construct a path from this:
Failing cases
The best solution I found so far:
I might be missing something, but I couldn't find a better solution so far.