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

fix: don't cancel build when default romfs directory not found #51

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::ffi::OsStr;
use std::io::{BufRead, BufReader};
use std::path::{Path, PathBuf};
use std::process::{Command, ExitStatus, Stdio};
use std::{env, io, process};
use std::{env, fs, io, process};

use cargo_metadata::{Message, MetadataCommand};
use command::{Input, Test};
Expand Down Expand Up @@ -352,15 +352,23 @@ pub fn build_3dsx(config: &CTRConfig, verbose: bool) {

// If romfs directory exists, automatically include it
let (romfs_path, is_default_romfs) = get_romfs_path(config);

if romfs_path.is_dir() {
// If we can't find the RomFS dir, we should at least regenerate it
// as `cargo 3ds new` creates an empty directory, meaning that it does not
// save to git. This means that if the user clones a project built with cargo-3ds,
// they will not have a RomFS directory, and would not be able to build.
if !is_default_romfs {
eprintln!(
"Could not find configured RomFS dir: {}. Creating...",
&romfs_path.display()
);

fs::create_dir(&romfs_path).unwrap();
}

eprintln!("Adding RomFS from {}", romfs_path.display());
command.arg(format!("--romfs={}", romfs_path.to_string_lossy()));
} else if !is_default_romfs {
eprintln!(
"Could not find configured RomFS dir: {}",
romfs_path.display()
);
process::exit(1);
}

if verbose {
Expand Down
Loading