summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-10-01 16:36:52 +0700
committerhathach <[email protected]>2013-10-01 16:36:52 +0700
commitfffd6138972832b8c6c5e12724ed43159e27122c (patch)
tree4d76e6ac12ca89ce9ee412a9925ce151c5dda70f
parent18b3179bc65a4080b71d3928baf5d64b43f2a53e (diff)
enhance cd command
-rw-r--r--demos/host/host_os_none/host_os_none.uvopt16
-rw-r--r--demos/host/src/cli.c20
2 files changed, 18 insertions, 18 deletions
diff --git a/demos/host/host_os_none/host_os_none.uvopt b/demos/host/host_os_none/host_os_none.uvopt
index 89f85a6cf..937f1c345 100644
--- a/demos/host/host_os_none/host_os_none.uvopt
+++ b/demos/host/host_os_none/host_os_none.uvopt
@@ -492,7 +492,7 @@
<Focus>0</Focus>
<ColumnNumber>25</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>153</TopLine>
+ <TopLine>154</TopLine>
<CurrentLine>160</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\src\main.c</PathWithFileName>
@@ -844,7 +844,7 @@
<Focus>0</Focus>
<ColumnNumber>21</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>2</TopLine>
+ <TopLine>3</TopLine>
<CurrentLine>8</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\tinyusb\host\usbh.c</PathWithFileName>
@@ -1092,7 +1092,7 @@
<Focus>0</Focus>
<ColumnNumber>3</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>574</TopLine>
+ <TopLine>575</TopLine>
<CurrentLine>580</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\bsp\lpc43xx\CMSIS_LPC43xx_DriverLib\src\lpc43xx_cgu.c</PathWithFileName>
@@ -1148,7 +1148,7 @@
<Focus>0</Focus>
<ColumnNumber>10</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>145</TopLine>
+ <TopLine>146</TopLine>
<CurrentLine>147</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\bsp\lpc43xx\startup_keil\startup_LPC43xx.s</PathWithFileName>
@@ -1172,7 +1172,7 @@
<Focus>0</Focus>
<ColumnNumber>23</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>107</TopLine>
+ <TopLine>108</TopLine>
<CurrentLine>113</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\vendor\fatfs\diskio.c</PathWithFileName>
@@ -1186,10 +1186,10 @@
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
- <ColumnNumber>66</ColumnNumber>
+ <ColumnNumber>32</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
- <TopLine>2021</TopLine>
- <CurrentLine>2037</CurrentLine>
+ <TopLine>2029</TopLine>
+ <CurrentLine>2043</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\vendor\fatfs\ff.c</PathWithFileName>
<FilenameWithoutPath>ff.c</FilenameWithoutPath>
diff --git a/demos/host/src/cli.c b/demos/host/src/cli.c
index 31ecbbdf0..8eca90e70 100644
--- a/demos/host/src/cli.c
+++ b/demos/host/src/cli.c
@@ -313,17 +313,17 @@ cli_error_t cli_cmd_changedir(char * p_para)
{
if ( strlen(p_para) == 0 ) return CLI_ERROR_INVALID_PARA;
- if ( (p_para[1] == ':') && (strlen(p_para) == 2) )
- { // change drive
- p_para[0] -= 'E';
- if ( ! ( disk_is_ready(p_para[0]) && FR_OK == f_chdrive(p_para[0]) )) return CLI_ERROR_INVALID_PARA;
- f_getlabel(NULL, volume_label, NULL);
- }else
+ drive_letter2number(p_para);
+
+ if ( FR_OK != f_chdir(p_para) )
{
- if ( FR_OK != f_chdir(p_para) )
- {
- return CLI_ERROR_INVALID_PATH;
- }
+ return CLI_ERROR_INVALID_PATH;
+ }
+
+ if ( p_para[1] == ':')
+ { // path has drive letter --> change drive, update volume label
+ f_chdrive(p_para[0] - '0');
+ f_getlabel(NULL, volume_label, NULL);
}
return CLI_ERROR_NONE;