xiaokangwang / AndroidLibV2ray

GNU Affero General Public License v3.0
99 stars 85 forks source link

what is the asset fileDir on the gomobile? #31

Open rurirei opened 3 years ago

rurirei commented 3 years ago

hello, could you please say the meaning or according of this dir? @xiaokangwang https://github.com/xiaokangwang/AndroidLibV2ray/blob/master/interact.go#L288

xiaokangwang commented 3 years ago

Hi, this is the directory that asset files are hold, like geoip.dat. The path here is a imaginary path, so that the access to these files can be redirected to another location.

rurirei commented 3 years ago

so that the access to these files can be redirected to another location

so this is a temporary filedir for the direction like this right?:

  temp_dir := "/temp/to/redirect"

  reader := func(path string) (io.ReadCloser, error) {
    if dir, name := filepath.Split(path); dir == temp_dir {
      return gomobileasset.Open(name)
    }
  }
xiaokangwang commented 3 years ago

so that the access to these files can be redirected to another location

so this is a temporary filedir for the direction like this right?:

  temp_dir := "/temp/to/redirect"

  reader := func(path string) (io.ReadCloser, error) {
    if dir, name := filepath.Split(path); dir == temp_dir {
      return gomobileasset.Open(name)
    }
  }

Yes, that is correct.