diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 71f3ac20e..a36075cab 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,4 +1,5 @@ -* @sonnyp +/src/langs/javascript/ @sonnyp +*.js @sonnyp /src/langs/vala/ @lw64 *.vala @lw64 diff --git a/.gitignore b/.gitignore index 0971b223a..8860b4d23 100644 --- a/.gitignore +++ b/.gitignore @@ -17,10 +17,3 @@ __pycache__ # IDEs / editors .idea - -# Project files - sync with Makefile -src/Library/**/settings -src/Library/**/workbench.vala -src/Library/**/main.ui -src/Library/**/libworkbenchcode.so -src/Library/**/__pycache__ diff --git a/data/app.metainfo.xml b/data/app.metainfo.xml index 0e8f37211..2f2153909 100644 --- a/data/app.metainfo.xml +++ b/data/app.metainfo.xml @@ -5,7 +5,7 @@ Workbench Sonny Piers - + Sonny Piers sonnyp@gnome.org diff --git a/src/langs/rust/Compiler.js b/src/langs/rust/Compiler.js index 4f479b414..b31796a0b 100644 --- a/src/langs/rust/Compiler.js +++ b/src/langs/rust/Compiler.js @@ -1,7 +1,11 @@ import Gio from "gi://Gio"; import GLib from "gi://GLib"; import dbus_previewer from "../../Previewer/DBusPreviewer.js"; -import { decode, encode } from "../../util.js"; +import { copyDirectory, decode, encode } from "../../util.js"; + +const rust_template_dir = Gio.File.new_for_path( + pkg.pkgdatadir, +).resolve_relative_path("langs/rust/template"); export default function Compiler({ session }) { const { file } = session; @@ -15,6 +19,8 @@ export default function Compiler({ session }) { let savedRustcVersion; async function compile() { + copyDirectory(rust_template_dir, file); + rustcVersion ||= await getRustcVersion(); savedRustcVersion ||= await getSavedRustcVersion({ rustcVersionFile }); diff --git a/src/sessions.js b/src/sessions.js index be3ebc874..9d71ff758 100644 --- a/src/sessions.js +++ b/src/sessions.js @@ -7,11 +7,11 @@ import { ensureDir, getNowForFilename, demos_dir, - rust_template_dir, settings as global_settings, encode, languages, settings, + copyDirectory, } from "./util.js"; export const sessions_dir = data_dir.get_child("sessions"); @@ -64,7 +64,6 @@ export function createSessionFromDemo(demo) { const { file, settings } = session; copyDirectory(demo_dir, file); - copyDirectory(rust_template_dir, file); settings.set_string("name", name); settings.set_boolean("show-code", panels.includes("code")); @@ -79,24 +78,6 @@ export function createSessionFromDemo(demo) { return session; } -// There is no copy directory function -function copyDirectory(source, destination) { - for (const file_info of source.enumerate_children( - "", - Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS, - null, - )) { - if (file_info.get_file_type() === Gio.FileType.DIRECTORY) continue; - const child = source.get_child(file_info.get_name()); - child.copy( - destination.get_child(child.get_basename()), - Gio.FileCopyFlags.NONE, - null, - null, - ); - } -} - export async function deleteSession(session) { // There is no method to recursively delete a folder so we trash instead // https://github.com/flatpak/xdg-desktop-portal/issues/630 :/ diff --git a/src/util.js b/src/util.js index 08b54c34e..75efd880d 100644 --- a/src/util.js +++ b/src/util.js @@ -177,9 +177,30 @@ export const demos_dir = Gio.File.new_for_path( pkg.pkgdatadir, ).resolve_relative_path("demos"); -export const rust_template_dir = Gio.File.new_for_path( - pkg.pkgdatadir, -).resolve_relative_path("langs/rust/template"); +// There is no copy directory function +export function copyDirectory(source, destination) { + for (const file_info of source.enumerate_children( + "", + Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS, + null, + )) { + if (file_info.get_file_type() === Gio.FileType.DIRECTORY) continue; + const child = source.get_child(file_info.get_name()); + + try { + child.copy( + destination.get_child(child.get_basename()), + Gio.FileCopyFlags.NONE, + null, + null, + ); + } catch (err) { + if (!err.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.EXISTS)) { + throw err; + } + } + } +} export function getNowForFilename() { return new GLib.DateTime().format("%Y-%m-%d %H-%M-%S");