Air中File類獲取位址的研究

2021-07-05 03:50:07 字數 1361 閱讀 9926

幫助文件中說得比較鬆散和含糊,這是自己實驗得到的結果

——————————————————————————————————

//此資料夾是壓縮包,唯讀

nativepath(win) = [絕對路徑]

nativepath(android) = ""

注意:不要在應用程式目錄(air 應用程式的安裝位置)中新增或刪除內容。否則會損壞 air 應用程式,應用程式簽名也將失效。air 預設不允許寫入應用程式目錄,因為該目錄並非對所有作業系統上的所有使用者帳戶均為可寫目錄

——————————————————————————————————

//可寫

——————————————————————————————————

file.documentsdirectory

//可寫

url(android)

= "file:///storage/emulated/0"

nativepath(ios) 

nativepath(win) 

= "d:\documents\[username]\my documents"

nativepath(android)

= "/storage/emulated/0"

——————————————————————————————————

file.desktopdirectory

nativepath(ios) 

//可寫

nativepath(win) 

= "d:\documents\[username]\desktop"

——————————————————————————————————

file.userdirectory

url(android) = "file:///storage/emulated/0"

nativepath(ios) 

//可寫

nativepath(win) 

= "c:\users\[username]"

nativepath(android)

= "/storage/emulated/0"

——————————————————————————————————

file.cachedirectory

nativepath(andorid) = /data/data/air.

url(

andorid) = file:///data/data/air.

File類的獲取功能

public string getabsolutepath 獲取絕對路徑 public string getpath 獲取相對路徑 public string getname 獲取檔案或者目錄名 public long length 獲取物件大小 public long lastmodified 獲...

Java 中File類的使用

1.file類的建構函式 file file new file string pathname 通過定義路徑名字字串轉換為抽象路徑來建立乙個file例項。file file new file string parent,string child 根據父路徑和子路徑字串建立乙個新的file物件。包括檔...

Java中File類的用法

檔案和目錄路徑名的抽象表現形式 方法名方法解釋 canread 測試應用程式是否可以讀取此抽象路徑名表示的檔案 canwrite 測試應用程式是否可以修改此抽象路徑名表示的檔案 compareto file pathname 按字母順序比較兩個抽象路徑名 canexecute 測試應用程式是否可以執...