1
新しいデータベースファイルを以前のデータベースファイルに置き換えるにはどうすればよいですか? 私の以前のデータベースは、フォルダ内にある:データベースを前のデータベースから新しいデータベースに置き換える
string filepath = Application.persistentDataPath + "/" + "Martyr.db";
マイアプリコード:
string filePath = Application.persistentDataPath + "/" + "Martyr.db";
string disPath;
if (!File.Exists(filePath))
{
disPath = System.IO.Path.Combine(Application.streamingAssetsPath, "Martyr.db");
WWW loadDB;
#if UNITY_ANDROID
{
loadDB = new WWW(disPath);
}
#if UNITY_EDITOR
{
loadDB = new WWW("file://" + Application.streamingAssetsPath + "/Martyr.db");
}
#else
{loadDB=new WWW(dispath);}
#endif
#endif
while (!loadDB.isDone)
{
}
File.WriteAllBytes(filePath, loadDB.bytes);
}
これは機能しません。 このエラーが発生しましたIOException:パス上の共有違反 – Seyed
データベースを削除しようとしていますか?それはどんなファイルストリームによって開かれていますか? –
ありがとうございます。そうだと思います。私のデータベースは公開されていました。 – Seyed