-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use std::fs::File; | ||
use std::io::Read; | ||
use std::io::Write; | ||
|
||
pub fn fix_files_in_gtfs_directory(path: &str) -> Result<(), anyhow::Error> { | ||
//read stop file | ||
let stops = format!("{}/stops.txt", path); | ||
|
||
let mut f = File::open(&stops)?; | ||
|
||
let mut buffer: Vec<u8> = Vec::new(); | ||
|
||
let read = f.read_to_end(&mut buffer)?; | ||
|
||
let stops_string = String::from_utf8_lossy(&buffer); | ||
|
||
//write stops string back | ||
|
||
let mut f = File::create(&stops)?; | ||
|
||
f.write_all(stops_string.as_bytes())?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters