Skip to content

Fix unable to read absolute path and check if reading from ~/#14

Open
jinwjinl wants to merge 3 commits into
vivoblueos:mainfrom
jinwjinl:fix_cd_command
Open

Fix unable to read absolute path and check if reading from ~/#14
jinwjinl wants to merge 3 commits into
vivoblueos:mainfrom
jinwjinl:fix_cd_command

Conversation

@jinwjinl

@jinwjinl jinwjinl commented Dec 12, 2025

Copy link
Copy Markdown
Contributor

Fixes #12.

@jinwjinl

Copy link
Copy Markdown
Contributor Author

32+0 records in
32+0 records out
33554432 bytes (34 MB, 32 MiB) copied, 0.0132506 s, 2.5 GB/s
Hello, shell!

cd ~
Error: Unable to determine home directory
ls
dev/
proc/
cd proc
ls
553652256/
553658176/
553662448/
553726080/
meminfo
stat
cd proc/553652256/
Error: Unable to change directory to '/proc/proc/553652256': Invalid argument (os error 22)
cd 553652256/
cd ~
Error: Unable to determine home directory
cd ~/
Error: Unable to determine home directory
cd /dev
ls
console
ttyS0

@lawkai-vivo lawkai-vivo changed the title fix can't read absolute path and add situation of reading home_dir fix unable to read absolute path and check if reading from ~/ Dec 12, 2025
@lawkai-vivo

Copy link
Copy Markdown
Contributor

build_prs #14

@lawkai-vivo
lawkai-vivo self-requested a review December 12, 2025 08:30
@lawkai-vivo lawkai-vivo changed the title fix unable to read absolute path and check if reading from ~/ Fix unable to read absolute path and check if reading from ~/ Dec 12, 2025
@github-actions

Copy link
Copy Markdown

Comment thread src/commands/cd.rs Outdated
let target_path = match target {
"." => env::current_dir().map_err(|e| format!("Unable to get current directory: {}", e))?,
"~" => {
// solely ~ means home directory

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Single ~ means home directory.

Comment thread src/commands/cd.rs Outdated

let path_obj = Path::new(path);
let mut path_buf = if path_obj.is_absolute() {
std::path::PathBuf::new() // if absolute, start from root

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::path::PathBuf::new() // if absolute, start from root
std::path::PathBuf::new()

Comment thread src/commands/cd.rs Outdated

use std::{env, path::Path};

fn home_dir() -> Option<std::path::PathBuf> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fn home_dir() -> Option<std::path::PathBuf> {
fn get_home() -> Option<std::path::PathBuf> {

@github-actions

Copy link
Copy Markdown

❌ Job failed. Failed jobs: check_format (failure), build_and_check_boards (failure), see https://github.com/vivoblueos/apps_shell/actions/runs/20160943659.

@lawkai-vivo

Copy link
Copy Markdown
Contributor

build_prs #14

@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

❌ Job failed. Failed jobs: check_format (failure), build_and_check_boards (failure), see https://github.com/vivoblueos/apps_shell/actions/runs/20297065702.

@lawkai-vivo

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

❌ Job failed. Failed jobs: build_and_check_boards (failure), see https://github.com/vivoblueos/apps_shell/actions/runs/20300708778.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cd命令,dst路径拼接问题

2 participants