Path must be an absolute path: <> cannotCreateNode(path: "")

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) } }

I’m sorry but I can’t read your code. Please post it again, using the Code Block button (triple backquotes) so that it renders nicely.

For more hints and tips on using DevForums effectively, see Quinn’s Top Ten DevForums Tips.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

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) } }




I still can’t read that.

I recommend that you review your post after you’ve posted it, to make sure it looks reasonable. If not, you have a short while (an hour maybe?) to edit it.

DevForums uses a Markdown-like syntax in its text editor. While we don’t have our own tutorial that explains how to write Markdown, there are many out their on the ’net and the basics work the same here as, say, on GitHub, or Swift DocC, or whatever.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

We are using roompaln api once data is capture CapturedRoom (this is in code finalResult). Then we are trying to save usdz file in file manager. Sometimes is working but sometimes we are getting like below

Warning: in SdfPath at line 151 of sdf/path.cpp -- Ill-formed SdfPath </9EE71ED0F8D6415496A7B9F0C3671DB0321>: syntax error
Coding Error: in _IsValidPathForCreatingPrim at line 3338 of usd/stage.cpp -- Path must be an absolute path: <>
cannotCreateNode(path: "/9EE71ED0F8D6415496A7B9F0C3671DB0321")```
```language
This is that code we are using for shaving CapturedRoom data
func saveFileLocal() {
          if let finalResult {
              let fm = FileManager.default
              let documentsURL = fm.urls(for: .documentDirectory, in: .userDomainMask).first!
              //let documentsURL = URL.documentsDirectory
              let fileName = "\(UUID().uuidString).usdz"
              let fileURL = documentsURL.appendingPathComponent(fileName)
              do {
                  try finalResult.export(to: fileURL)
              } catch {
                  print(error)
              }
          }
      }```

Please help us. 

Thanks for clarifying this.

Unfortunately I don’t think I can help you here. AFAICT this isn’t a file system issue but something deep in the RoomPlan USDZ suppor, and that’s far removed from my area of expertise.

If no one else chimes in, I recommend that you open a DTS tech support incident and talk to our RoomPlan expert.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I've got the same problem (https://developer.apple.com/forums/thread/738801) - Per Quinn's suggestion, TSI Case-ID: 4368872 submitted

[@Shiv Sharma](https://developer.apple.com/forums/profile/Shiv Sharma) Try starting your file name with a non-number. DTS got back to me with a workaround, have a letter at the front of your filename, and it'll export correctly.

It's a leaky abstraction, implementation details about UDSZ have escaped and affect our choice of filenames (courtesy of DTS: a requirement of the USD spec, see the documentation here: https://openusd.org/dev/api/group__group__tf___string.html#gaa129b294af3f68d01477d430b70d40c8)

Feedback reported: FB13240732

(and Shiv, I bet your code works 40% of the time, when you have a hex digit as the start of your UUID. Guess you lucked out getting a bad file name to start out with! :-) )

Path must be an absolute path: &lt;&gt; cannotCreateNode(path: "")
 
 
Q