少用File#nativePath, 用File#url
Sunday, March 22nd, 2009File.nativePath 是完整的絕對路徑,如果直接用nativePath的值當作路徑,在mac上有時會出現IOError。然而,File.url 會把applicationStorage的路徑用app-storage: 替換掉,參照的時候再轉換,對於不同的系統結構,用File.url是比較保險的作法。
var docs:File = File.applicationStorageDirectory;
trace(docs.nativePath); // C:\Documents and Settings\user\Application Data\my_air\Local Store\
trace(docs.url); // app-storage:/
trace(docs.nativePath); // C:\Documents and Settings\user\Application Data\my_air\Local Store\
trace(docs.url); // app-storage:/
