1
Fork 0
mirror of https://github.com/redstrate/Physis.git synced 2025-04-25 13:57:45 +00:00

Use PathBuf in get_index_file

This commit is contained in:
Joshua Goins 2022-08-09 20:00:02 -04:00
parent 99fc3165e5
commit d318dcb788

View file

@ -1,6 +1,6 @@
use std::fs; use std::fs;
use std::fs::DirEntry; use std::fs::DirEntry;
use std::path::PathBuf; use std::path::{Path, PathBuf};
use crate::common::Language; use crate::common::Language;
use crate::dat::DatFile; use crate::dat::DatFile;
use crate::exd::EXD; use crate::exd::EXD;
@ -91,10 +91,13 @@ impl GameData {
fn get_index_file(&self, path: &str) -> Option<IndexFile> { fn get_index_file(&self, path: &str) -> Option<IndexFile> {
let (repository, category) = self.parse_repository_category(path).unwrap(); let (repository, category) = self.parse_repository_category(path).unwrap();
let index_path = format!("{}/sqpack/{}/{}", let index_path : PathBuf = [self.game_directory.clone(),
self.game_directory, repository.name, repository.index_filename(category)); "sqpack".to_string(),
repository.name.clone(),
repository.index_filename(category)]
.iter().collect();
IndexFile::from_existing(index_path.as_str()) IndexFile::from_existing(index_path.to_str()?)
} }
/// Checks if a file located at `path` exists. /// Checks if a file located at `path` exists.