Skip to content

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

Open
jinwjinl wants to merge 3 commits intovivoblueos:mainfrom
jinwjinl:fix_cd_command
Open

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

Conversation

@jinwjinl
Copy link
Contributor

@jinwjinl jinwjinl commented Dec 12, 2025

Fixes #12.

@jinwjinl
Copy link
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
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

let target_path = match target {
"." => env::current_dir().map_err(|e| format!("Unable to get current directory: {}", e))?,
"~" => {
// solely ~ means home directory
Copy link
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.


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
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()


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

fn home_dir() -> Option<std::path::PathBuf> {
Copy link
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

❌ 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
Contributor

build_prs #14

@github-actions
Copy link

@github-actions
Copy link

❌ 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
Contributor

@github-actions
Copy link

@github-actions
Copy link

❌ 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