Correct issue with default.project.json files with no name being named default after change (#917)

Co-authored-by: Kenneth Loeffler <kenloef@gmail.com>
This commit is contained in:
Micah
2024-07-15 09:24:51 -07:00
committed by GitHub
parent 7e2bab921a
commit 3ca975d81d
13 changed files with 244 additions and 76 deletions

View File

@@ -63,6 +63,9 @@ pub fn snapshot_from_vfs(
if meta.is_dir() {
if let Some(init_path) = get_init_path(vfs, path)? {
// TODO: support user-defined init paths
// If and when we do, make sure to go support it in
// `Project::set_file_name`, as right now it special-cases
// `default.project.json` as an `init` path.
for rule in default_sync_rules() {
if rule.matches(&init_path) {
return match rule.middleware {
@@ -274,7 +277,7 @@ macro_rules! sync_rule {
/// Defines the 'default' syncing rules that Rojo uses.
/// These do not broadly overlap, but the order matters for some in the case of
/// e.g. JSON models.
fn default_sync_rules() -> &'static [SyncRule] {
pub fn default_sync_rules() -> &'static [SyncRule] {
static DEFAULT_SYNC_RULES: OnceLock<Vec<SyncRule>> = OnceLock::new();
DEFAULT_SYNC_RULES.get_or_init(|| {