ryanbaldwin / Cute

A simple way to create, process, and observe Queues in Swift
Apache License 2.0
0 stars 1 forks source link

crash with xcode writing to Cute's persistence directory #1

Open xinsight opened 5 years ago

xinsight commented 5 years ago

Hi Ryan,

I ran into an interesting problem with Cute. Xcode/lldb would save code coverage info (default.profraw) to Cute's working directory, which would then cause Cute to barf when it found a file that was not the json it expected.

Why does lldb save to Cute's working directory? Well, the problem seems to be with the use of FileManger and changing the current working directory. Have a look at Apple's hilarious comments in the header:

/* Process working directory management. Despite the fact that these are instance methods on
NSFileManager, these methods report and change (respectively) the working directory for the
entire process. Developers are cautioned that doing so is fraught with peril.
     */
    open var currentDirectoryPath: String { get }

    open func changeCurrentDirectoryPath(_ path: String) -> Bool

Thanks Apple! So basically, we need to use absolute paths. I'm going to add this - but just thought i'd leave a note here in case anyone else runs into this issue.

ryanbaldwin commented 5 years ago

That, my friend, is awesome. Best docstring I’ve read this week. I’ll take a look at this when I have a spare cycle or two this week. Thanks a bunch dude!