@@ -66,25 +66,20 @@ fn pack_dat(art_key: &String, input: &PathBuf, output: &PathBuf) -> anyhow::Resu
66
66
let mut assets: Vec < AssetMetadata > = Vec :: new ( ) ;
67
67
let mut asset_bytes: Vec < u8 > = Vec :: new ( ) ;
68
68
69
- // let localized_assets = match locale_mode {
70
- // I18nCompatMode::None => Vec::new(),
71
- // _ => find_localized_assets(&args.game).unwrap_or_else(|e| {
72
- // eprintln!("Error while finding localized assets: {}. Disabling localization mode.", e);
73
- // Vec::new()
74
- // }),
75
- // };
76
-
77
69
for file in WalkDir :: new ( input) {
78
70
let file = file. unwrap ( ) ;
79
71
if file. file_type ( ) . is_dir ( ) {
80
72
continue ;
81
73
}
82
74
83
75
let path = file. path ( ) ;
84
- let name = path. strip_prefix ( input) ?. to_str ( )
76
+ let mut name = path. strip_prefix ( input) ?. to_str ( )
85
77
. context ( "Failed to convert path to string" ) ?
86
78
. to_string ( ) ;
87
79
let size = path. metadata ( ) ?. len ( ) as usize ;
80
+ if !name. starts_with ( "assets/" ) {
81
+ name = format ! ( "assets/{}" , name) ;
82
+ }
88
83
89
84
println ! ( "Packing asset: {} ({} bytes)" , name, size) ;
90
85
assets. push ( AssetMetadata { name, size } ) ;
@@ -110,32 +105,3 @@ fn pack_dat(art_key: &String, input: &PathBuf, output: &PathBuf) -> anyhow::Resu
110
105
111
106
Ok ( ( ) )
112
107
}
113
-
114
- // fn find_localized_assets(game_dir: &PathBuf) -> anyhow::Result<Vec<String>> {
115
- // let english_loc = game_dir
116
- // .join("PapersPlease_Data")
117
- // .join("StreamingAssets")
118
- // .join("loc")
119
- // .join("en.zip");
120
- //
121
- // if !english_loc.exists() {
122
- // anyhow::bail!("English localization not found at: {}", english_loc.display());
123
- // }
124
- // let mut assets: Vec<String> = Vec::new();
125
- // let zip_handle = File::open(english_loc)?;
126
- // let mut zip = ZipArchive::new(zip_handle)?;
127
- // for i in 0..zip.len() {
128
- // let file = zip.by_index(i)?;
129
- // if file.is_dir() {
130
- // continue;
131
- // }
132
- //
133
- // // TODO: bail or skip?
134
- // assets.push(format!("assets/{}", file
135
- // .enclosed_name().ok_or_else(|| anyhow::anyhow!("Failed to get zip entry name"))?
136
- // .to_str().ok_or_else(|| anyhow::anyhow!("Failed to convert file name to string"))?
137
- // ));
138
- // }
139
- //
140
- // Ok(assets)
141
- // }
0 commit comments