1
Fork 0
mirror of https://github.com/redstrate/Physis.git synced 2025-04-25 05:47: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::DirEntry;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use crate::common::Language;
use crate::dat::DatFile;
use crate::exd::EXD;
@ -91,10 +91,13 @@ impl GameData {
fn get_index_file(&self, path: &str) -> Option<IndexFile> {
let (repository, category) = self.parse_repository_category(path).unwrap();
let index_path = format!("{}/sqpack/{}/{}",
self.game_directory, repository.name, repository.index_filename(category));
let index_path : PathBuf = [self.game_directory.clone(),
"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.