Post not yet marked as solved
Post marked as unsolved with 8 replies, 698 views
We are trying to save usdz file in file manager some time its saved but some time we are getting the error. Like: path.absoluteURL file:///var/mobile/Containers/Data/Application/6D14A430-47B4-45F2-9D0D-6C31588A6A03/Documents/2896837C-C7E0-4FA8-BFE2-21A59B26D801.usdz Warning: in SdfPath at line 151 of sdf/path.cpp -- Ill-formed SdfPath </2896837CC7E04FA8BFE221A59B26D801>: syntax error Coding Error: in _IsValidPathForCreatingPrim at line 3338 of usd/stage.cpp -- Path must be an absolute path: <> cannotCreateNode(path: "/2896837CC7E04FA8BFE221A59B26D801")
func saveFileLocal() {
if let finalResult {
let fm = FileManager.default
var path = fm.urls(for: .documentDirectory, in: .userDomainMask).first!
let fileName = "(UUID().uuidString).usdz"
path.appendPathComponent(fileName)
do {
try finalResult.export(to: path.absoluteURL)
}
catch{
print(error)
}
}
}
func removeFiles() {
var filePath = ""
let fm = FileManager.default
let path = fm.urls(for: .documentDirectory, in: .userDomainMask).first!
do{
let content = try fm.contentsOfDirectory(atPath: path.path)
for c in content{
filePath = path.appendingPathComponent(c).absoluteString
if let url = URL(string: filePath){
try fm.removeItem(at: url)
}
}
}
catch{
print(error)
}
}