I’m stuck on Stage #(The cd builtin: Home directory #gp4
).
I’ve tried apply different function to get to home directory but still, it is showing error in the test cases
Here are my logs:
$ cd /tmp/blueberry/apple/mango
[your-program] $ pwd
[your-program] /tmp/blueberry/apple/mango
[tester::#GP4] Received current working directory response
[your-program] $ cd ~
[your-program] $ pwd
[your-program] /app
[tester::#GP4] Output does not match expected value.
[tester::#GP4] Expected: "/tmp/grape/blueberry/pineapple"
[tester::#GP4] Received: "/app"
[your-program] $
[tester::#GP4] Assertion failed.
[tester::#GP4] Test failed
@Seya-Mali You can replace System.getProperty("user.home") with System.getenv("HOME").
The shell you’re implementing is expected to respect the $HOME environment variable.
However, System.getProperty("user.home") only uses $HOME as a fallback source, which means you’ll need to explicitly rely on System.getenv("HOME") for consistent behavior.
this is the test case result
Output does not match expected value.
remote: [tester::#GP4] Expected: “/tmp/pear/pear/apple”
remote: [tester::#GP4] Received: “null”
remote: [your-program] $
remote: [tester::#GP4] Assertion failed.
remote: [tester::#GP4] Test failed
this is the result in my vscode
cd ~
$ pwd
C:\Users\seyam
it is still showing null when i replaced
private static final String homeDirectory = System.getProperty(“user.home”);
with
private static final String homeDirectory = System.getenv(“USERPROFILE”);