Revert "Rust Day 7 - Better cd /" because it actually broke things?

This reverts commit ec9f1e92bc.
This commit is contained in:
Tobias Berger 2022-12-12 10:19:06 +01:00
parent 252f9d9515
commit 2437fc0e6f
Signed by: toby
GPG key ID: 2D05EFAB764D6A88
2 changed files with 6 additions and 4 deletions

View file

@ -9,8 +9,9 @@ pub(crate) fn part_1(input: &Vec<ConsoleLine>) -> usize {
for line in input { for line in input {
match line { match line {
ConsoleLine::MoveRoot => { ConsoleLine::MoveRoot => {
current_directory.clear(); while current_directory.len() > 1 {
current_directory.push(""); current_directory.pop();
}
} }
ConsoleLine::MoveUp => { ConsoleLine::MoveUp => {
current_directory.pop(); current_directory.pop();

View file

@ -11,8 +11,9 @@ pub(crate) fn part_2(input: &Vec<ConsoleLine>) -> usize {
for line in input { for line in input {
match line { match line {
ConsoleLine::MoveRoot => { ConsoleLine::MoveRoot => {
current_directory.clear(); while current_directory.len() > 1 {
current_directory.push(""); current_directory.pop();
}
} }
ConsoleLine::MoveUp => { ConsoleLine::MoveUp => {
current_directory.pop(); current_directory.pop();