enhance cd command

This commit is contained in:
hathach 2013-10-01 16:36:52 +07:00
parent 18b3179bc6
commit fffd613897
2 changed files with 18 additions and 18 deletions

View File

@ -492,7 +492,7 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>25</ColumnNumber> <ColumnNumber>25</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>153</TopLine> <TopLine>154</TopLine>
<CurrentLine>160</CurrentLine> <CurrentLine>160</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\src\main.c</PathWithFileName> <PathWithFileName>..\src\main.c</PathWithFileName>
@ -844,7 +844,7 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>21</ColumnNumber> <ColumnNumber>21</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>2</TopLine> <TopLine>3</TopLine>
<CurrentLine>8</CurrentLine> <CurrentLine>8</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\..\..\tinyusb\host\usbh.c</PathWithFileName> <PathWithFileName>..\..\..\tinyusb\host\usbh.c</PathWithFileName>
@ -1092,7 +1092,7 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>3</ColumnNumber> <ColumnNumber>3</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>574</TopLine> <TopLine>575</TopLine>
<CurrentLine>580</CurrentLine> <CurrentLine>580</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\..\bsp\lpc43xx\CMSIS_LPC43xx_DriverLib\src\lpc43xx_cgu.c</PathWithFileName> <PathWithFileName>..\..\bsp\lpc43xx\CMSIS_LPC43xx_DriverLib\src\lpc43xx_cgu.c</PathWithFileName>
@ -1148,7 +1148,7 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>10</ColumnNumber> <ColumnNumber>10</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>145</TopLine> <TopLine>146</TopLine>
<CurrentLine>147</CurrentLine> <CurrentLine>147</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\..\bsp\lpc43xx\startup_keil\startup_LPC43xx.s</PathWithFileName> <PathWithFileName>..\..\bsp\lpc43xx\startup_keil\startup_LPC43xx.s</PathWithFileName>
@ -1172,7 +1172,7 @@
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>23</ColumnNumber> <ColumnNumber>23</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>107</TopLine> <TopLine>108</TopLine>
<CurrentLine>113</CurrentLine> <CurrentLine>113</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\..\..\vendor\fatfs\diskio.c</PathWithFileName> <PathWithFileName>..\..\..\vendor\fatfs\diskio.c</PathWithFileName>
@ -1186,10 +1186,10 @@
<FileType>1</FileType> <FileType>1</FileType>
<tvExp>0</tvExp> <tvExp>0</tvExp>
<Focus>0</Focus> <Focus>0</Focus>
<ColumnNumber>66</ColumnNumber> <ColumnNumber>32</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<TopLine>2021</TopLine> <TopLine>2029</TopLine>
<CurrentLine>2037</CurrentLine> <CurrentLine>2043</CurrentLine>
<bDave2>0</bDave2> <bDave2>0</bDave2>
<PathWithFileName>..\..\..\vendor\fatfs\ff.c</PathWithFileName> <PathWithFileName>..\..\..\vendor\fatfs\ff.c</PathWithFileName>
<FilenameWithoutPath>ff.c</FilenameWithoutPath> <FilenameWithoutPath>ff.c</FilenameWithoutPath>

View File

@ -313,17 +313,17 @@ cli_error_t cli_cmd_changedir(char * p_para)
{ {
if ( strlen(p_para) == 0 ) return CLI_ERROR_INVALID_PARA; if ( strlen(p_para) == 0 ) return CLI_ERROR_INVALID_PARA;
if ( (p_para[1] == ':') && (strlen(p_para) == 2) ) drive_letter2number(p_para);
{ // change drive
p_para[0] -= 'E'; if ( FR_OK != f_chdir(p_para) )
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
{ {
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; return CLI_ERROR_NONE;