mirror of
https://github.com/Shabinder/SpotiFlyer.git
synced 2024-11-26 02:24:31 +01:00
Improve Special Character Remover
This commit is contained in:
parent
73bd43d23c
commit
9add1dd88c
2
.github/workflows/build-release-binaries.yml
vendored
2
.github/workflows/build-release-binaries.yml
vendored
@ -82,7 +82,7 @@ jobs:
|
|||||||
draft: true
|
draft: true
|
||||||
allowUpdates: true
|
allowUpdates: true
|
||||||
tag: "v3.3.1"
|
tag: "v3.3.1"
|
||||||
artifacts: "desktop/build/compose/jars/*.jar,desktop/build/compose/binaries/main/*/*,android/build/outputs/apk/release/*"
|
artifacts: "desktop/build/compose/jars/*.jar,desktop/build/compose/binaries/main/*/*,android/build/outputs/apk/release/*signed.apk"
|
||||||
token: ${{ secrets.GH_TOKEN }}
|
token: ${{ secrets.GH_TOKEN }}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package com.shabinder.common.utils
|
package com.shabinder.common.utils
|
||||||
|
|
||||||
import io.github.shabinder.TargetPlatforms
|
|
||||||
import io.github.shabinder.activePlatform
|
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import kotlin.native.concurrent.ThreadLocal
|
import kotlin.native.concurrent.ThreadLocal
|
||||||
|
|
||||||
@ -17,41 +15,5 @@ val globalJson by lazy {
|
|||||||
* Removing Illegal Chars from File Name
|
* Removing Illegal Chars from File Name
|
||||||
* **/
|
* **/
|
||||||
fun removeIllegalChars(fileName: String): String {
|
fun removeIllegalChars(fileName: String): String {
|
||||||
if (activePlatform is TargetPlatforms.Js) return fileName
|
return fileName.replace("[^\\dA-Za-z_]".toRegex(), "_")
|
||||||
val illegalCharArray = charArrayOf(
|
|
||||||
'/',
|
|
||||||
'\n',
|
|
||||||
'\r',
|
|
||||||
'\t',
|
|
||||||
'\u0000',
|
|
||||||
'\u000C',
|
|
||||||
'`',
|
|
||||||
'?',
|
|
||||||
'*',
|
|
||||||
'\\',
|
|
||||||
'<',
|
|
||||||
'>',
|
|
||||||
'|',
|
|
||||||
'\"',
|
|
||||||
'.',
|
|
||||||
'-',
|
|
||||||
'\''
|
|
||||||
)
|
|
||||||
|
|
||||||
var name = fileName
|
|
||||||
for (c in illegalCharArray) {
|
|
||||||
name = fileName.replace(c, '_')
|
|
||||||
}
|
|
||||||
name = name.replace("\\s".toRegex(), "_")
|
|
||||||
name = name.replace("/".toRegex(), "_")
|
|
||||||
name = name.replace("\\)".toRegex(), "")
|
|
||||||
name = name.replace("\\(".toRegex(), "")
|
|
||||||
name = name.replace("\\[".toRegex(), "")
|
|
||||||
name = name.replace("]".toRegex(), "")
|
|
||||||
name = name.replace("\\.".toRegex(), "")
|
|
||||||
name = name.replace("\"".toRegex(), "")
|
|
||||||
name = name.replace("\'".toRegex(), "")
|
|
||||||
name = name.replace(":".toRegex(), "")
|
|
||||||
name = name.replace("\\|".toRegex(), "")
|
|
||||||
return name
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user