4

Phonegap /Cordova2.2を使用しています

サブディレクトリの内容を読み込もうとしていますが、その方法がわかりません。

これが私のコードです:

 window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccess, fail);

function onFileSystemSuccess(fileSystem) {

var tmpPath = "dir1/dir2/";

fileSystem.root.getDirectory(tmpPath, {create: false, exclusive: false}, getDirSuccess, fail);           
}


function getDirSuccess(dirEntry) {

// Get a directory reader
var directoryReader = dirEntry.createReader();

// Get a list of all the entries in the directory
directoryReader.readEntries(readerSuccess,fail);
}

1つのディレクトリパスのみをフェッチすると機能しますが、2つのディレクトリを持つパスをフェッチしようとすると失敗します。

どんな助けでもいただければ幸いです。

ありがとう

4

1 に答える 1

5

さて、あなたはこのようにすることができます:

function onFileSystemSuccess(fileSystem) {
    var tmpPath = filesystem.root.fullPath + "/dir1/dir2";
    window.resolveLocalFileSystemURI(tmpPath, getDirSuccess, fail);           
}

しかし、あなたが示したコードが機能しなかった理由が気になります。どのプラットフォームでテストしていますか?

于 2012-11-29T02:00:37.340 に答える