當前位置: 首頁>>代碼示例>>Java>>正文


Java SanitizedFile.knownSanitized方法代碼示例

本文整理匯總了Java中org.fdroid.fdroid.data.SanitizedFile.knownSanitized方法的典型用法代碼示例。如果您正苦於以下問題:Java SanitizedFile.knownSanitized方法的具體用法?Java SanitizedFile.knownSanitized怎麽用?Java SanitizedFile.knownSanitized使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.fdroid.fdroid.data.SanitizedFile的用法示例。


在下文中一共展示了SanitizedFile.knownSanitized方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: writeFdroidApkToWebroot

import org.fdroid.fdroid.data.SanitizedFile; //導入方法依賴的package包/類
private String writeFdroidApkToWebroot() {
    ApplicationInfo appInfo;
    String fdroidClientURL = "https://f-droid.org/FDroid.apk";

    try {
        appInfo = pm.getApplicationInfo(fdroidPackageName, PackageManager.GET_META_DATA);
        SanitizedFile apkFile = SanitizedFile.knownSanitized(appInfo.publicSourceDir);
        SanitizedFile fdroidApkLink = new SanitizedFile(fdroidDir, "F-Droid.apk");
        attemptToDelete(fdroidApkLink);
        if (Utils.symlinkOrCopyFileQuietly(apkFile, fdroidApkLink)) {
            fdroidClientURL = "/" + fdroidDir.getName() + "/" + fdroidApkLink.getName();
        }
    } catch (PackageManager.NameNotFoundException e) {
        Log.e(TAG, "Could not set up F-Droid apk in the webroot", e);
    }
    return fdroidClientURL;
}
 
開發者ID:uhuru-mobile,項目名稱:mobile-store,代碼行數:18,代碼來源:LocalRepoManager.java

示例2: writeFdroidApkToWebroot

import org.fdroid.fdroid.data.SanitizedFile; //導入方法依賴的package包/類
private String writeFdroidApkToWebroot() {
    ApplicationInfo appInfo;
    String fdroidClientURL = "https://f-droid.org/FDroid.apk";

    try {
        appInfo = pm.getApplicationInfo(fdroidPackageName, PackageManager.GET_META_DATA);
        SanitizedFile apkFile = SanitizedFile.knownSanitized(appInfo.publicSourceDir);
        SanitizedFile fdroidApkLink = new SanitizedFile(webRoot, "fdroid.client.apk");
        attemptToDelete(fdroidApkLink);
        if (Utils.symlinkOrCopyFileQuietly(apkFile, fdroidApkLink)) {
            fdroidClientURL = "/" + fdroidApkLink.getName();
        }
    } catch (PackageManager.NameNotFoundException e) {
        Log.e(TAG, "Could not set up F-Droid apk in the webroot", e);
    }
    return fdroidClientURL;
}
 
開發者ID:CmDnoEdition,項目名稱:fdroid,代碼行數:18,代碼來源:LocalRepoManager.java

示例3: LocalRepoManager

import org.fdroid.fdroid.data.SanitizedFile; //導入方法依賴的package包/類
private LocalRepoManager(Context c) {
    context = c.getApplicationContext();
    pm = c.getPackageManager();
    assetManager = c.getAssets();
    fdroidPackageName = c.getPackageName();

    webRoot = SanitizedFile.knownSanitized(c.getFilesDir());
    /* /fdroid/repo is the standard path for user repos */
    fdroidDir = new SanitizedFile(webRoot, "fdroid");
    fdroidDirCaps = new SanitizedFile(webRoot, "FDROID");
    repoDir = new SanitizedFile(fdroidDir, "repo");
    repoDirCaps = new SanitizedFile(fdroidDirCaps, "REPO");
    iconsDir = new SanitizedFile(repoDir, "icons");
    xmlIndexJar = new SanitizedFile(repoDir, "index.jar");
    xmlIndexJarUnsigned = new SanitizedFile(repoDir, "index.unsigned.jar");

    if (!fdroidDir.exists() && !fdroidDir.mkdir()) {
        Log.e(TAG, "Unable to create empty base: " + fdroidDir);
    }

    if (!repoDir.exists() && !repoDir.mkdir()) {
        Log.e(TAG, "Unable to create empty repo: " + repoDir);
    }

    if (!iconsDir.exists() && !iconsDir.mkdir()) {
        Log.e(TAG, "Unable to create icons folder: " + iconsDir);
    }
}
 
開發者ID:uhuru-mobile,項目名稱:mobile-store,代碼行數:29,代碼來源:LocalRepoManager.java

示例4: setUp

import org.fdroid.fdroid.data.SanitizedFile; //導入方法依賴的package包/類
@Before
public void setUp() {
    Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
    File dir = getWriteableDir(instrumentation);
    sourceFile = SanitizedFile.knownSanitized(
            AssetUtils.copyAssetToDir(instrumentation.getContext(), "simpleIndex.jar", dir));
    destFile = new SanitizedFile(dir, "dest-" + UUID.randomUUID() + ".testproduct");
    assertFalse(destFile.exists());
    assertTrue(sourceFile.getAbsolutePath() + " should exist.", sourceFile.exists());
}
 
開發者ID:uhuru-mobile,項目名稱:mobile-store,代碼行數:11,代碼來源:FileCompatTest.java

示例5: LocalRepoManager

import org.fdroid.fdroid.data.SanitizedFile; //導入方法依賴的package包/類
private LocalRepoManager(Context c) {
    context = c.getApplicationContext();
    pm = c.getPackageManager();
    assetManager = c.getAssets();
    fdroidPackageName = c.getPackageName();

    webRoot = SanitizedFile.knownSanitized(c.getFilesDir());
    /* /fdroid/repo is the standard path for user repos */
    fdroidDir = new SanitizedFile(webRoot, "fdroid");
    fdroidDirCaps = new SanitizedFile(webRoot, "FDROID");
    repoDir = new SanitizedFile(fdroidDir, "repo");
    repoDirCaps = new SanitizedFile(fdroidDirCaps, "REPO");
    iconsDir = new SanitizedFile(repoDir, "icons");
    xmlIndex = new SanitizedFile(repoDir, "index.xml");
    xmlIndexJar = new SanitizedFile(repoDir, "index.jar");
    xmlIndexJarUnsigned = new SanitizedFile(repoDir, "index.unsigned.jar");

    if (!fdroidDir.exists() && !fdroidDir.mkdir()) {
        Log.e(TAG, "Unable to create empty base: " + fdroidDir);
    }

    if (!repoDir.exists() && !repoDir.mkdir()) {
        Log.e(TAG, "Unable to create empty repo: " + repoDir);
    }

    if (!iconsDir.exists() && !iconsDir.mkdir()) {
        Log.e(TAG, "Unable to create icons folder: " + iconsDir);
    }
}
 
開發者ID:CmDnoEdition,項目名稱:fdroid,代碼行數:30,代碼來源:LocalRepoManager.java

示例6: setUp

import org.fdroid.fdroid.data.SanitizedFile; //導入方法依賴的package包/類
@Before
public void setUp() {
    Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
    File dir = TestUtils.getWriteableDir(instrumentation);
    sourceFile = SanitizedFile.knownSanitized(TestUtils.copyAssetToDir(instrumentation.getContext(), "simpleIndex.jar", dir));
    destFile = new SanitizedFile(dir, "dest-" + UUID.randomUUID() + ".testproduct");
    assertFalse(destFile.exists());
    assertTrue(sourceFile.getAbsolutePath() + " should exist.", sourceFile.exists());
}
 
開發者ID:CmDnoEdition,項目名稱:fdroid,代碼行數:10,代碼來源:FileCompatTest.java


注:本文中的org.fdroid.fdroid.data.SanitizedFile.knownSanitized方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。