Skip to content

Commit

Permalink
Merge pull request iqiyi#7 from iqiyi/fixFileSeperatorBug
Browse files Browse the repository at this point in the history
Fix file seperator bug
  • Loading branch information
HiWong authored Apr 26, 2018
2 parents 53250fb + e8ade90 commit 24f704b
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

public class RemoteGuardService extends Service {

private static final String TAG = "StarBridge";
private static final String TAG = "Andromeda";

public static final String REMOTE_GUARD_SERIVCE_MODULE = "RemoteGuardServiceModule";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class JarUtils {
*/
static List<String> unzipJar(String jarPath, String destDirPath) {

println "unzipJar,jarPath:"+jarPath

List<String> list = new ArrayList()
if (jarPath.endsWith('.jar')) {

Expand All @@ -60,7 +62,8 @@ class JarUtils {
continue
}

String outFileName = destDirPath + "/" + entryName
String outFileName = destDirPath + File.separator + entryName
println "outFileName:"+outFileName

File outFile = new File(outFileName)
outFile.getParentFile().mkdirs()
Expand All @@ -82,10 +85,23 @@ class JarUtils {
*/
static void zipJar(String packagePath, String destPath) {

println "zipJar,packagePath:"+packagePath+",destPath:"+destPath

File file = new File(packagePath)
JarOutputStream outputStream = new JarOutputStream(new FileOutputStream(destPath))
file.eachFileRecurse { File f ->

//println "f.getAbsolutePath():"+f.getAbsolutePath()

String entryName = f.getAbsolutePath().substring(packagePath.length() + 1)
//println "before replace,entryName:"+entryName

entryName=entryName.replaceAll("\\\\","/")

//println "after replace,entryName:"+entryName

//println "entryName:"+entryName

outputStream.putNextEntry(new ZipEntry(entryName))
if (!f.directory) {
InputStream inputStream = new FileInputStream(f)
Expand Down
4 changes: 2 additions & 2 deletions CHINESE_README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Andromeda
![Andromeda_license](https://img.shields.io/badge/license-BSD--3--Clause-brightgreen.svg)
![Andromeda_core_tag](https://img.shields.io/badge/Andromeda%20core-1.0.6-brightgreen.svg)
![Andromeda_plugin_tag](https://img.shields.io/badge/Andromeda%20plugin-1.0.6-brightgreen.svg)
![Andromeda_core_tag](https://img.shields.io/badge/Andromeda%20core-1.1.0-brightgreen.svg)
![Andromeda_plugin_tag](https://img.shields.io/badge/Andromeda%20plugin-1.1.0-brightgreen.svg)

Andromeda提供了接口式的组件间通信管理,包括同进程的本地接口调用和跨进程接口调用。

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Andromeda
![Andromeda_license](https://img.shields.io/badge/license-BSD--3--Clause-brightgreen.svg)
![Andromeda_core_tag](https://img.shields.io/badge/Andromeda%20core-1.0.6-brightgreen.svg)
![Andromeda_plugin_tag](https://img.shields.io/badge/Andromeda%20plugin-1.0.6-brightgreen.svg)
![Andromeda_core_tag](https://img.shields.io/badge/Andromeda%20core-1.1.0-brightgreen.svg)
![Andromeda_plugin_tag](https://img.shields.io/badge/Andromeda%20plugin-1.1.0-brightgreen.svg)

Andromeda provides communication among modules for both local and remote service.

Expand Down
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ dependencies {
implementation 'com.android.support:design:26.0.2'

implementation "org.qiyi.video.svg:core:$maven_config.build_version"
//implementation "org.qiyi.video.svg:core:1.0.6"

//implementation project(":Andromeda-Plugin")

implementation 'com.android.support:appcompat-v7:26.0.2'
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<resources>
<string name="app_name">StarBridge</string>
<string name="app_name">Andromeda</string>
</resources>
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ buildscript {
'userName':USER_NAME,
'groupId':GROUP_ID,
'passWord':PASS_WORD,
'version_code':106,
'version_name':'1.0.6',
'build_version':'1.0.6'
'version_code':110,
'version_name':'1.1.0',
'build_version':'1.1.0'
]

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class StubServiceMatchInjector {
}

String filePath = jarInput.file.getAbsolutePath()

//TODO 不能直接用"/"而是要用File.seperator
if (filePath.endsWith(".jar") && !filePath.contains("com.android.support")
&& !filePath.contains("/com/android/support")) {

Expand All @@ -108,7 +108,7 @@ class StubServiceMatchInjector {

}
}

//TODO 这里其实有优化的空间,就是可以直接从内存进行zipJar操作,而不必先写入到文件,然后又从文件读出进行zipJar操作
private void prepareInjectMatchCode(String filePath) {

println "prepareInjectMatchCode"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class JarUtils {
*/
static List<String> unzipJar(String jarPath, String destDirPath) {

println "unzipJar,jarPath:"+jarPath

List<String> list = new ArrayList()
if (jarPath.endsWith('.jar')) {

Expand All @@ -60,7 +62,8 @@ class JarUtils {
continue
}

String outFileName = destDirPath + "/" + entryName
String outFileName = destDirPath + File.separator + entryName
//println "outFileName:"+outFileName

File outFile = new File(outFileName)
outFile.getParentFile().mkdirs()
Expand All @@ -82,10 +85,23 @@ class JarUtils {
*/
static void zipJar(String packagePath, String destPath) {

println "zipJar,packagePath:"+packagePath+",destPath:"+destPath

File file = new File(packagePath)
JarOutputStream outputStream = new JarOutputStream(new FileOutputStream(destPath))
file.eachFileRecurse { File f ->

//println "f.getAbsolutePath():"+f.getAbsolutePath()

String entryName = f.getAbsolutePath().substring(packagePath.length() + 1)
//println "before replace,entryName:"+entryName

entryName=entryName.replaceAll("\\\\","/")

//println "after replace,entryName:"+entryName

//println "entryName:"+entryName

outputStream.putNextEntry(new ZipEntry(entryName))
if (!f.directory) {
InputStream inputStream = new FileInputStream(f)
Expand Down

0 comments on commit 24f704b

Please sign in to comment.