本文整理了Java中android.system.Os.symlink()
方法的一些代码示例,展示了Os.symlink()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Os.symlink()
方法的具体详情如下:
包路径:android.system.Os
类名称:Os
方法名:symlink
暂无
代码示例来源:origin: android-hacker/VirtualXposed
public static void createSymlink(String oldPath, String newPath) throws Exception {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Os.symlink(oldPath, newPath);
} else {
Runtime.getRuntime().exec("ln -s " + oldPath + " " + newPath).waitFor();
}
}
代码示例来源:origin: termux/termux-app
Os.symlink(sharedDir.getAbsolutePath(), new File(storageDir, "shared").getAbsolutePath());
Os.symlink(downloadsDir.getAbsolutePath(), new File(storageDir, "downloads").getAbsolutePath());
Os.symlink(dcimDir.getAbsolutePath(), new File(storageDir, "dcim").getAbsolutePath());
Os.symlink(picturesDir.getAbsolutePath(), new File(storageDir, "pictures").getAbsolutePath());
Os.symlink(musicDir.getAbsolutePath(), new File(storageDir, "music").getAbsolutePath());
Os.symlink(moviesDir.getAbsolutePath(), new File(storageDir, "movies").getAbsolutePath());
if (dir == null) continue;
String symlinkName = "external-" + i;
Os.symlink(dir.getAbsolutePath(), new File(storageDir, symlinkName).getAbsolutePath());
代码示例来源:origin: termux/termux-app
throw new RuntimeException("No SYMLINKS.txt encountered");
for (Pair<String, String> symlink : symlinks) {
Os.symlink(symlink.first, symlink.second);
代码示例来源:origin: android-hacker/VirtualXposed
@SuppressLint("SdCardPath")
private void startIOUniformer() {
ApplicationInfo info = mBoundApplication.appInfo;
int userId = VUserHandle.myUserId();
String wifiMacAddressFile = deviceInfo.getWifiFile(userId).getPath();
NativeEngine.redirectDirectory("/sys/class/net/wlan0/address", wifiMacAddressFile);
NativeEngine.redirectDirectory("/sys/class/net/eth0/address", wifiMacAddressFile);
NativeEngine.redirectDirectory("/sys/class/net/wifi/address", wifiMacAddressFile);
NativeEngine.redirectDirectory("/data/data/" + info.packageName, info.dataDir);
NativeEngine.redirectDirectory("/data/user/0/" + info.packageName, info.dataDir);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
NativeEngine.redirectDirectory("/data/user_de/0/" + info.packageName, info.dataDir);
}
String libPath = VEnvironment.getAppLibDirectory(info.packageName).getAbsolutePath();
String userLibPath = new File(VEnvironment.getUserSystemDirectory(userId), info.packageName + "/lib").getAbsolutePath();
NativeEngine.redirectDirectory(userLibPath, libPath);
NativeEngine.redirectDirectory("/data/data/" + info.packageName + "/lib/", libPath);
NativeEngine.redirectDirectory("/data/user/0/" + info.packageName + "/lib/", libPath);
File dataUserLib = new File(VEnvironment.getDataUserPackageDirectory(userId, info.packageName), "lib");
if (!dataUserLib.exists()) {
try {
Os.symlink(libPath, dataUserLib.getPath());
} catch (ErrnoException e) {
VLog.w(TAG, "symlink error", e);
}
}
setupVirtualStorage(info, userId);
NativeEngine.enableIORedirect();
}
代码示例来源:origin: darkskygit/VirtualApp
public static void createSymlink(String oldPath, String newPath) throws Exception {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Os.symlink(oldPath, newPath);
} else {
Runtime.getRuntime().exec("ln -s " + oldPath + " " + newPath).waitFor();
}
}
代码示例来源:origin: bzsome/VirtualApp-x326
public static void createSymlink(String oldPath, String newPath) throws Exception {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Os.symlink(oldPath, newPath);
} else {
Runtime.getRuntime().exec("ln -s " + oldPath + " " + newPath).waitFor();
}
}
内容来源于网络,如有侵权,请联系作者删除!