mirror of
https://github.com/amnezia-vpn/amnezia-libxray.git
synced 2026-05-17 06:55:44 +03:00
Fix Android assets path
This commit is contained in:
@@ -10,11 +10,14 @@ import (
|
||||
)
|
||||
|
||||
// Prepare Xray for android
|
||||
func InitXray() {
|
||||
func InitXray(assetsPath string) {
|
||||
xrayfs.NewFileReader = func(path string) (io.ReadCloser, error) {
|
||||
if _, err := os.Stat(path); os.IsNotExist(err) {
|
||||
_, file := filepath.Split(path)
|
||||
return mobasset.Open(file)
|
||||
asset, err := filepath.Rel(assetsPath, path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return mobasset.Open(asset)
|
||||
}
|
||||
return os.Open(path)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user