swifter: Broken shareFilesFromDirectory() ?

I was having trouble serving files from a location using shareFilesFromDirectory and tracked it down to a couple of lines in Socket+File.swift. This may be completely the wrong solution and it seems odd that no-one’s picked up on it but it’s working for me now so if it helps anyone …

line 10: #if os(iOS) || os(tvOS) || os (Linux) || os (macOS) // ka added macOS

and line 44: #if os(iOS) || os(tvOS) || os (Linux) || os (macOS) // KA: Added macOS

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 2
  • Comments: 17 (7 by maintainers)

Most upvoted comments

macOS Mojave, 10.14.4, Xcode Version 10.2 (10E125), by the way

I’ve dropped a stripped down version of the project into my dropbox here . sorry about any junk left in there.

built out of the box it fails when you browse to http://localhost:8082/root/<foo.html. Editing the two lines I’ve marked in Socket+File.swift to include (macOS) should fix it. I found I had to clean the build folder to get Socket+File.swift to compile

You’ll need a folder with some html in an NSHomeDirectory ( “/Users/<yourhome>/Library/Containers/com.kim-aldis.EarwigServer/Data/htdocs”)