Skip to content

Instantly share code, notes, and snippets.

View marcprux's full-sized avatar
🔆

Marc Prud'hommeaux marcprux

🔆
  • New England
  • 05:50 (UTC -04:00)
View GitHub Profile
func loadSourceRoot() throws -> URL {
let env = ProcessInfo.processInfo.environment // "DYLD_LIBRARY_PATH": "/Users/marc/Library/Developer/Xcode/DerivedData/App-eyahphpvsfdoezahxmpgdlrnhwxg/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection"
guard let dyld = env["DYLD_LIBRARY_PATH"]?.split(separator: ":").first else { // e.g. /Users/marc/Library/Developer/Xcode/DerivedData/App-eyahphpvsfdoezahxmpgdlrnhwxg/Build/Products/Debug-iphonesimulator
throw CocoaError(.fileNoSuchFile)
}
// we have a bunch of potential places to guess here, but this is one of them…
let workspaceInfo = URL(fileURLWithPath: "../../../info.plist", isDirectory: false, relativeTo: URL(fileURLWithPath: String(dyld), isDirectory: true))
/// This example provides a `installSystemCertificates()` function that will
/// locate the standard Android certificate directories and assemble all the contents into
/// a single cacerts.pem file that can be loaded by libcurl, which enables
/// `Foundation.URLSession` to load HTTPS sites.
import Foundation
#if canImport(FoundationNetworking)
import FoundationNetworking
#endif
#if canImport(Android)
import Android
@marcprux
marcprux / skip-mkicon.sh
Last active January 10, 2025 00:42
Script to convert a PDF or SVG into iOS and Android app icons for a Skip project
#!/bin/sh -ex
# This script should be executed in the root of a Skip project
# It will convert the specified image source (typically a PDF)
# into all the required icons for the Darwin/ and Android/ versions
#
# Prerequisite: `brew install imagemagick`
#
# e.g.: skip.iconconvert.sh Sources/Showcase/Resources/Module.xcassets/skiplogo.imageset/skiplogo.pdf
which magick &> /dev/null || (echo "$(basename $0): error: magick command not found (install imagemagick)"; exit 1)