Pass &str instead of &String
This commit is contained in:
parent
76b895e4c1
commit
c3c2726537
|
@ -39,7 +39,7 @@ use ::metadata::cuex::NrgCuexTrack;
|
|||
///
|
||||
/// The output file's name will be `img_path`'s base name stripped for its
|
||||
/// extension (if any), with a ".cue" extension.
|
||||
pub fn write_cue_sheet(img_path: &String, metadata: &NrgMetadata)
|
||||
pub fn write_cue_sheet(img_path: &str, metadata: &NrgMetadata)
|
||||
-> Result<(), NrgError> {
|
||||
// Make sure we have a cue sheet in the metadata
|
||||
let cuex_tracks = match metadata.cuex_chunk {
|
||||
|
@ -51,7 +51,7 @@ pub fn write_cue_sheet(img_path: &String, metadata: &NrgMetadata)
|
|||
let img_name = PathBuf::from(img_path);
|
||||
let img_name = match img_name.file_name() {
|
||||
Some(name) => name,
|
||||
None => return Err(NrgError::FileName(img_path.clone())),
|
||||
None => return Err(NrgError::FileName(img_path.to_string())),
|
||||
};
|
||||
|
||||
// Set the cue sheet file's name
|
||||
|
|
|
@ -41,7 +41,7 @@ const RAW96_SEC_SIZE: u16 = 2448;
|
|||
///
|
||||
/// The output file's name is derived from `img_path`.
|
||||
pub fn extract_nrg_raw_audio(in_fd: &mut File,
|
||||
img_path: &String,
|
||||
img_path: &str,
|
||||
metadata: &NrgMetadata)
|
||||
-> Result<(), NrgError> {
|
||||
// Seek to the first audio byte
|
||||
|
@ -152,14 +152,14 @@ fn copy_raw96_audio(in_fd: &mut File, out_fd: &mut File, count: u64)
|
|||
///
|
||||
/// The output file's name will be `img_path`'s base name stripped for its
|
||||
/// extension (if any), with a ".raw" extension.
|
||||
fn make_output_file_name(img_path: &String) -> Result<String, NrgError> {
|
||||
fn make_output_file_name(img_path: &str) -> Result<String, NrgError> {
|
||||
let mut name = PathBuf::from(img_path);
|
||||
name.set_extension("raw");
|
||||
let name = try!(name.file_name().ok_or(
|
||||
NrgError::FileName(name.to_string_lossy().into_owned())));
|
||||
|
||||
// Make sure the new name and the original name are different
|
||||
if name == img_path.as_str() {
|
||||
if name == img_path {
|
||||
return Err(NrgError::FileName("Input and output file are identical"
|
||||
.to_string()));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue