!890 ufs 代码同步3

Merge pull request !890 from chensihan/userfilesync
This commit is contained in:
openharmony_ci 2024-07-23 04:33:11 +00:00 committed by Gitee
commit e77d3b825f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -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);
}