#What's the right way to reference files in the Public directory?

1 messages · Page 1 of 1 (latest)

mental canyon
#

What's the right way to reference files in the Public directory, such that a route can find those files, whether build from swift build, or Xcode? app.directory.publicDirectory points to the build products dir, and adding "Public" as a resource copy step gives a build error that Public can't be found.

#

Oh, it's looking for Public under sources/myapp/Public. I tried doing .copy("../../Public") and now swift run says "Found unhandled resource at /Users/rmann/Projects/Personal/BuzzwordBingo/bingo/Public"

#

But it works. However, Xcode does not seem to copy the directory.

#

Rather, it copies into Build/Products/Debug/bingo_bingo.bundle/Contents/Resources/Public, which is not referenced by inApp.directory.publicDirectory

restive jewel
#

Have you set the custom working directory in Xcode?

oblique ermine
#

You can also initialize File Middleware with a bundle: FileMiddleware(bundle: .module), just make sure your Public folder is in the target's folder, and you have a .copy("Public") step

mental canyon