Skip to content

Commit a039e2e

Browse files
committed
feat: consolidate project rename changesets
The original implementation split project rename changesets based on project type: blueprint or code. After extracting module and target renames into their own workflows, the distinction between the project types disappeared. This commit consolidates the changesets into a single one.
1 parent 67d8a3a commit a039e2e

File tree

6 files changed

+57
-399
lines changed

6 files changed

+57
-399
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
use std::path::Path;
2+
3+
use crate::{
4+
changes::{Change, RenameFile, SetIniEntry},
5+
workflows::rename_project::context::Context,
6+
};
7+
8+
/// Generate a changeset to rename an Unreal Engine project.
9+
pub fn generate_changeset(context: &Context) -> Vec<Change> {
10+
let Context {
11+
project_root,
12+
project_name: old_name,
13+
target_name: new_name,
14+
} = context;
15+
16+
vec![
17+
add_game_name_to_engine_config(project_root, new_name),
18+
add_project_name_to_game_config(project_root, new_name),
19+
rename_project_descriptor(project_root, old_name, new_name),
20+
rename_project_root(project_root, new_name),
21+
]
22+
}
23+
24+
fn rename_project_descriptor(project_root: &Path, old_name: &str, new_name: &str) -> Change {
25+
Change::RenameFile(RenameFile::new(
26+
project_root.join(old_name).with_extension("uproject"),
27+
project_root.join(new_name).with_extension("uproject"),
28+
))
29+
}
30+
31+
fn add_game_name_to_engine_config(project_root: &Path, new_name: &str) -> Change {
32+
Change::SetIniEntry(SetIniEntry::new(
33+
project_root.join("Config/DefaultEngine.ini"),
34+
"URL",
35+
"GameName",
36+
new_name,
37+
))
38+
}
39+
40+
fn add_project_name_to_game_config(project_root: &Path, new_name: &str) -> Change {
41+
Change::SetIniEntry(SetIniEntry::new(
42+
project_root.join("Config/DefaultGame.ini"),
43+
"/Script/EngineSettings.GeneralProjectSettings",
44+
"ProjectName",
45+
new_name,
46+
))
47+
}
48+
49+
fn rename_project_root(project_root: &Path, new_name: &str) -> Change {
50+
Change::RenameFile(RenameFile::new(
51+
&project_root,
52+
project_root.with_file_name(new_name),
53+
))
54+
}

src/workflows/rename_project/changesets/blueprint.rs

Lines changed: 0 additions & 113 deletions
This file was deleted.

src/workflows/rename_project/changesets/code.rs

Lines changed: 0 additions & 216 deletions
This file was deleted.

src/workflows/rename_project/changesets/mod.rs

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)