3

JavaScriptファイルシステムAPIを使用してディレクトリの名前を変更するにはどうすればよいですか?

私は以下のように試しました:

dirNameWithPath = '/MyPictures3/New Folder';
newDirName = 'newTitle';
dirPath = '/MyPictures3';

filesystem.root.getDirectory(dirNameWithPath, {}, function(dirEntry) {
    dirEntry.moveTo(dirPath, newDirName, callback, errorHandler);
}); 

次のエラーが発生します。

FileError.INVALID_MODIFICATION_ERR
4

1 に答える 1

2

の最初のパラメータは (文字列ではない) でmoveToなければなりませんDirectoryEntry:

void moveTo(DirectoryEntry parent,
            optional DOMString newName,
            optional EntryCallback successCallback,
            optional ErrorCallback errorCallback);

parentパラメータは「エントリを移動するディレクトリ」です。

「entry」は、移動/名前変更するディレクトリです( directory.moveTo(newLocation, newName))。

于 2013-01-01T17:48:53.287 に答える