mirror of
https://gitee.com/openharmony/filemanagement_user_file_service
synced 2024-11-23 07:20:41 +00:00
commit
e77d3b825f
@ -768,6 +768,23 @@ export default class FileExtAbility extends Extension {
|
||||
return `file://docs/storage/hmdfs/${path}`;
|
||||
}
|
||||
|
||||
getHmdfsPath(): {}[] {
|
||||
let rootPathHmdfs = '/storage/hmdfs';
|
||||
let hmdfsInfoList = [];
|
||||
let hmdfsName = fs.listFileSync(rootPathHmdfs);
|
||||
for (let i = 0; i < hmdfsName.length; i++) {
|
||||
let hmdfsInfo = {
|
||||
uri: this.hmdfsPath2uri(hmdfsName[i]),
|
||||
displayName: hmdfsName[i],
|
||||
relativePath: '/storage/hmdfs/' + hmdfsName[i],
|
||||
deviceType: deviceType.DEVICE_SHARED_TERMINAL,
|
||||
deviceFlags: deviceFlag.SUPPORTS_READ | deviceFlag.SUPPORTS_WRITE,
|
||||
};
|
||||
hmdfsInfoList.push(hmdfsInfo);
|
||||
}
|
||||
return hmdfsInfoList;
|
||||
}
|
||||
|
||||
getRoots() {
|
||||
let roots = [
|
||||
{
|
||||
@ -802,20 +819,7 @@ export default class FileExtAbility extends Extension {
|
||||
roots = roots.concat(volumeInfoList);
|
||||
|
||||
try {
|
||||
let rootPathHmdfs = '/storage/hmdfs';
|
||||
let hmdfsInfoList = [];
|
||||
let hmdfsName = fs.listFileSync(rootPathHmdfs);
|
||||
for (let i = 0; i < hmdfsName.length; i++) {
|
||||
let hmdfsInfo = {
|
||||
uri: this.hmdfsPath2uri(hmdfsName[i]),
|
||||
displayName: hmdfsName[i],
|
||||
relativePath: '/storage/hmdfs/' + hmdfsName[i],
|
||||
deviceType: deviceType.DEVICE_SHARED_TERMINAL,
|
||||
deviceFlags: deviceFlag.SUPPORTS_READ | deviceFlag.SUPPORTS_WRITE,
|
||||
};
|
||||
hmdfsInfoList.push(hmdfsInfo);
|
||||
}
|
||||
roots = roots.concat(hmdfsInfoList);
|
||||
roots = roots.concat(getHmdfsPath());
|
||||
} catch (e) {
|
||||
hilog.info(DOMAIN_CODE, TAG, 'getRoots errorcode: ' + e.code, ' message: ' + e.message);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user