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

PublishingContext.copyResources() fails when Ignite included as a package #135

Open
vdhamer opened this issue Oct 11, 2024 · 1 comment · May be fixed by #136
Open

PublishingContext.copyResources() fails when Ignite included as a package #135

vdhamer opened this issue Oct 11, 2024 · 1 comment · May be fixed by #136

Comments

@vdhamer
Copy link
Contributor

vdhamer commented Oct 11, 2024

            for asset in assets {
                try FileManager.default.copyItem(
                    at: assetsDirectory.appending(path: asset.lastPathComponent),
                    to: buildDirectory.appending(path: asset.lastPathComponent)
                )
            }

This is copying from the wrong directory (when Ignite is not a stand-alone project).

This in turn is due to the following 'constructor' in URL.selectDirectiries(from:)

            return SourceBuildDirectories(source: buildDirectoryURL,
                                          build: buildDirectoryURL)

where (when Ignite is not a stand-alone project) the source: and build: directories should be different. They clearly are identical.

The bug does not affect projects where Ignite runs stand-alone and the code detects a Package.swift file.
I will submit a PR (I apparently introduced this bug myself in #126, but see also discussion in #127).

@vdhamer
Copy link
Contributor Author

vdhamer commented Oct 13, 2024

False alarm!

I had forgotten that the code of a regular app cannot access its own source directories at runtime.
So any images, .md files, handmade HTML files, etc need to be copied over to the sandbox at /Users/<user>/Library/Container/<myApp>/Data by the website developer: a MacOS app doesn't have the privileges to do that unless you disable sandboxing.

I will still submit a PR now with a cleanup with extra comments to URL-SelectDirectories.swift to document this.
The README.md file probably still needs updating, but that awaits a direction on #127 by @twostraws.
I am also fine with a draft README section on the directory usage in both cases, followed by me/someone adapting the code to match the spec and chosen terminology.

@vdhamer vdhamer linked a pull request Oct 13, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant