Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
c3a89f58
Commit
c3a89f58
authored
Jul 25, 2019
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Download to proper filename
parent
971cd73f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
9 deletions
+8
-9
Repo.java
...src/main/java/com/topjohnwu/magisk/model/entity/Repo.java
+2
-1
DownloadSubject.kt
...topjohnwu/magisk/model/entity/internal/DownloadSubject.kt
+1
-1
Utils.kt
app/src/main/java/com/topjohnwu/magisk/utils/Utils.kt
+0
-6
XString.kt
app/src/main/java/com/topjohnwu/magisk/utils/XString.kt
+5
-1
No files found.
app/src/main/java/com/topjohnwu/magisk/model/entity/Repo.java
View file @
c3a89f58
...
@@ -7,6 +7,7 @@ import android.os.Parcelable;
...
@@ -7,6 +7,7 @@ import android.os.Parcelable;
import
com.topjohnwu.magisk.Const
;
import
com.topjohnwu.magisk.Const
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.XStringKt
;
import
java.text.DateFormat
;
import
java.text.DateFormat
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -103,7 +104,7 @@ public class Repo extends BaseModule {
...
@@ -103,7 +104,7 @@ public class Repo extends BaseModule {
}
}
public
String
getDownloadFilename
()
{
public
String
getDownloadFilename
()
{
return
Utils
.
INSTANCE
.
getL
egalFilename
(
getName
()
+
"-"
+
getVersion
()
+
".zip"
);
return
XStringKt
.
l
egalFilename
(
getName
()
+
"-"
+
getVersion
()
+
".zip"
);
}
}
public
class
IllegalRepoException
extends
Exception
{
public
class
IllegalRepoException
extends
Exception
{
...
...
app/src/main/java/com/topjohnwu/magisk/model/entity/internal/DownloadSubject.kt
View file @
c3a89f58
...
@@ -27,7 +27,7 @@ sealed class DownloadSubject : Parcelable {
...
@@ -27,7 +27,7 @@ sealed class DownloadSubject : Parcelable {
@IgnoredOnParcel
@IgnoredOnParcel
override
val
file
by
lazy
{
override
val
file
by
lazy
{
File
(
Config
.
downloadDirectory
,
"${module.name}-v${module.version}(${module.versionCode}).zip"
)
File
(
Config
.
downloadDirectory
,
module
.
downloadFilename
)
}
}
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/utils/Utils.kt
View file @
c3a89f58
...
@@ -70,12 +70,6 @@ object Utils {
...
@@ -70,12 +70,6 @@ object Utils {
return
info
.
loadLabel
(
pm
).
toString
()
return
info
.
loadLabel
(
pm
).
toString
()
}
}
fun
getLegalFilename
(
filename
:
CharSequence
):
String
{
return
filename
.
toString
().
replace
(
" "
,
"_"
).
replace
(
"'"
,
""
).
replace
(
"\""
,
""
)
.
replace
(
"$"
,
""
).
replace
(
"`"
,
""
).
replace
(
"*"
,
""
).
replace
(
"/"
,
"_"
)
.
replace
(
"#"
,
""
).
replace
(
"@"
,
""
).
replace
(
"\\"
,
"_"
)
}
@WorkerThread
@WorkerThread
fun
loadModulesLeanback
():
Map
<
String
,
OldModule
>
{
fun
loadModulesLeanback
():
Map
<
String
,
OldModule
>
{
val
moduleMap
=
ValueSortedMap
<
String
,
OldModule
>()
val
moduleMap
=
ValueSortedMap
<
String
,
OldModule
>()
...
...
app/src/main/java/com/topjohnwu/magisk/utils/XString.kt
View file @
c3a89f58
...
@@ -20,4 +20,8 @@ fun Int.res(vararg args: Any): String {
...
@@ -20,4 +20,8 @@ fun Int.res(vararg args: Any): String {
return
resources
.
getString
(
this
,
*
args
)
return
resources
.
getString
(
this
,
*
args
)
}
}
fun
String
.
trimEmptyToNull
():
String
?
=
if
(
isBlank
())
null
else
this
fun
String
.
trimEmptyToNull
():
String
?
=
if
(
isBlank
())
null
else
this
\ No newline at end of file
fun
String
.
legalFilename
()
=
replace
(
" "
,
"_"
).
replace
(
"'"
,
""
).
replace
(
"\""
,
""
)
.
replace
(
"$"
,
""
).
replace
(
"`"
,
""
).
replace
(
"*"
,
""
).
replace
(
"/"
,
"_"
)
.
replace
(
"#"
,
""
).
replace
(
"@"
,
""
).
replace
(
"\\"
,
"_"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment