Revert "Rust Day 7 - Better cd /
" because it actually broke things?
This reverts commit ec9f1e92bc
.
This commit is contained in:
parent
252f9d9515
commit
2437fc0e6f
2 changed files with 6 additions and 4 deletions
|
@ -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();
|
||||||
|
|
|
@ -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();
|
||||||
|
|
Loading…
Reference in a new issue