Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong files path for StaticFileServer and views for render (Swift 5.1 Xcode 11.2.x and macOS 10.15.x) #1493

Open
MadGeorge opened this issue Nov 16, 2019 · 2 comments

Comments

@MadGeorge
Copy link

When I build my Kitura project without any updates

.package(url: "https://github.com/IBM-Swift/Kitura.git", .upToNextMinor(from: "2.7.0"))
.package(url: "https://github.com/IBM-Swift/Kitura-StencilTemplateEngine", from: "1.11.1")

on my new Mac (macOS 10.15.1, Xcode 11.2.1 Swift 5.1), project builds and runs fine, but local path location does not work. Engine can not load any stencil template or serve static files.

When i trigger something like try resp.render("index.stencil", context: ["title": "title"]) response is

The operation couldn’t be completed. (KituraStencil.StencilTemplateEngineError error 1.)

Not any .css or .js files loaded in static html files rendered via resp.send(html) from static files directory.

I set breakpoint at
fileServer.serveFile(filePath, requestPath: requestPath, queryString: queryString, response: response)
in sample project (Kitura/StaticFileServer.swift) and got filePath equals to
/Users/username/Library/Developer/Xcode/DerivedData/Kitura-Sample-master-dpowtcfjwuvoqafwzhnollapcnid/SourcePackages/checkouts/Kitura/./public/test.html which looks like an issue. Default path in StaticFileServer.init is "./public" and it leads to unexpected location under Kitura dir in DerivedData/blablabla/checkouts.

It looks like entire path location system broken when Kitura build under Swift 5.1 Xcode 11.2.x and macOS 10.15.x.

I think Kitura-StencilTemplateEngine issue 48 have same issue.

We need solution in short time. I have two project in production powered by Kitura which needs to be supported.

@MadGeorge MadGeorge changed the title Wrong files path for StaticFileServer and when Kitura (Swift 5.1 Xcode 11.2.x and macOS 10.15.x) Wrong files path for StaticFileServer and views for render (Swift 5.1 Xcode 11.2.x and macOS 10.15.x) Nov 29, 2019
@diuming
Copy link

diuming commented Dec 27, 2019

Just enable Working Directory
wd

@MadGeorge
Copy link
Author

@diuming thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants