当前位置: 首页>>代码示例>>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;未经允许,请勿转载。