mirror of
https://github.com/go-i2p/go-i2pbrowser.git
synced 2025-07-13 20:41:35 -04:00
change API slightly
This commit is contained in:
20
unembed.go
20
unembed.go
@ -19,40 +19,40 @@ func existsAlready(profileDir string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func UnpackBase(profileDir string) error {
|
||||
func UnpackBase(profileDir string) (string, error) {
|
||||
if existsAlready(profileDir) {
|
||||
log.Println(profileDir, "exists already")
|
||||
return nil
|
||||
return filepath.Join(profileDir, "i2p.firefox.base.profile"), nil
|
||||
}
|
||||
os.MkdirAll(filepath.Dir(profileDir), 0755)
|
||||
zipFile := filepath.Join(filepath.Dir(profileDir), "i2p.firefox.base.profile.zip")
|
||||
err := ioutil.WriteFile(zipFile, baseProfile, 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
return filepath.Join(profileDir, "i2p.firefox.base.profile"), err
|
||||
}
|
||||
uz := unzip.New()
|
||||
_, err = uz.Extract(zipFile, profileDir)
|
||||
if err != nil {
|
||||
return err
|
||||
return filepath.Join(profileDir, "i2p.firefox.base.profile"), err
|
||||
}
|
||||
return nil
|
||||
return filepath.Join(profileDir, "i2p.firefox.base.profile"), nil
|
||||
}
|
||||
|
||||
func UnpackUsability(profileDir string) error {
|
||||
func UnpackUsability(profileDir string) (string, error) {
|
||||
if existsAlready(profileDir) {
|
||||
log.Println(profileDir, "exists already")
|
||||
return nil
|
||||
return filepath.Join(profileDir, "i2p.firefox.usability.profile"), nil
|
||||
}
|
||||
os.MkdirAll(filepath.Dir(profileDir), 0755)
|
||||
zipFile := filepath.Join(filepath.Dir(profileDir), "i2p.firefox.usability.profile.zip")
|
||||
err := ioutil.WriteFile(zipFile, usabilityProfile, 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
return filepath.Join(profileDir, "i2p.firefox.usability.profile"), err
|
||||
}
|
||||
uz := unzip.New()
|
||||
_, err = uz.Extract(zipFile, profileDir)
|
||||
if err != nil {
|
||||
return err
|
||||
return filepath.Join(profileDir, "i2p.firefox.usability.profile"), err
|
||||
}
|
||||
return nil
|
||||
return filepath.Join(profileDir, "i2p.firefox.usability.profile"), nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user