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

Build for linux does not copy resources folder content #37

Open
sh1l0n opened this issue Dec 3, 2020 · 1 comment
Open

Build for linux does not copy resources folder content #37

sh1l0n opened this issue Dec 3, 2020 · 1 comment

Comments

@sh1l0n
Copy link

sh1l0n commented Dec 3, 2020

In the build.sh script the app-bundle is generated only for MacOSX devices but if we compile from Linux we also want the resources.
So maybe we need to add an else condition in that script. The modified build.sh could be something as the next

gtk=`echo .build/checkouts/SwiftGtk*/Sources/Gtk/Gtk-3.0.swift`
[ -e $gtk ] || ./generate-wrapper.sh
swift build $CCFLAGS $LINKFLAGS "$@"
if [ `uname` = "Darwin" ]; then
	. ./app-bundle.sh
else
	cp -r $RESOURCES_DIR/* $BUILD_BIN/ 	
fi

I found the problem while trying to load css file from resources throught the next function:

func readCssFile(forResource: String) {
    if let fileURL = Bundle.main.url(forResource: forResource, withExtension: "css") { 
        if let fileContents = try? String(contentsOf: fileURL) {
            if let screen = ScreenRef.getDefault(), let css = try? CSSProvider(from: fileContents) {
                screen.add(provider: css, priority: STYLE_PROVIDER_PRIORITY_APPLICATION)
            }
        }
    }
}
@rhx
Copy link
Owner

rhx commented Dec 13, 2020

This is probably something that the app-bundle.sh script (or an install script) should be doing. At the moment, the app-bundle script is macOS only. The question is what would be a good app structure on Linux that is somewhat idiomatic for different desktop environments (such as Gnome, KDE, etc.)?

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