Page 1 of 1

rshell directory syntax

Posted: Sun Dec 01, 2019 12:16 am
by smhodge
Does rshell support the usual directory syntax, such as "cd .." to go to the parent directory, or "." for current directory? I'm having trouble using rshell and this may be the root of my problems. Thanks

Re: rshell directory syntax

Posted: Sun Dec 01, 2019 3:54 am
by dhylands
Yep. It tries to treat the micropython filesystem as an extension of the host file system, and tries to provide a command line like experience similar to Linux. I don’t know how cd . behaves but cd .. should behave as expected.

What type of problems are you running into? Can you include a copy of a session with problems?

Re: rshell directory syntax

Posted: Tue Dec 03, 2019 6:54 pm
by smhodge
The issue is cd won't back up higher than the directory rshell was opened in. It goes down and then back up ok.

I use Windows to open powershell in my top-level uPython project folder, "D:\steve\Projects\uPython", and then run a batch file in that folder to open rshell. The batch file is simply:

@echo off
python "C:\Program Files\Python37\Lib\site-packages\rshell\main.py" -n

The rshell prompt is then (as expected):

D:\steve\Projects\uPython>

But, for example:

D:\steve\Projects\uPython> ls
COS/ Flash1.sln Flash2/ ReplCode.txt Test/ rshell.bat
Docs/ Flash1/ Flash3/ ReplSession 1.txt Test1/ rsync.bat
D:\steve\Projects\uPython> cd test
D:\steve\Projects\uPython/test>
D:\steve\Projects\uPython/test> ls
boot.py testLed.pycd ..
D:\steve\Projects\uPython/test> cd ..
D:\steve\Projects\uPython>
D:\steve\Projects\uPython> cd ..
D:\steve\Projects\uPython>

steve

Re: rshell directory syntax

Posted: Tue Dec 03, 2019 11:22 pm
by dhylands
It seems to be a windows peculiarity.

rshell is looking for a forward slash cd and when you do cd .. it will remove any trailing directory delimited by a forward slash.

Under windows, the current directory is presented with a back-slash and that's what's causing the problem.

I'll file an issue with rshell.

Re: rshell directory syntax

Posted: Wed Dec 04, 2019 12:00 am
by dhylands
As a temporary workaround, from the rshell prompt you can do a cd /steve/Projects/uPython then cd .. should work.

rshell still doesn't recognize drive letters, so there isn't any way to access files on the C: drive from the D: drive.

Re: rshell directory syntax

Posted: Wed Dec 04, 2019 11:33 pm
by smhodge
Thanks. Yes, it works to go back up the tree once you've gone down the tree from the start point. It just can't go further up than the start point.