mirror of
https://github.com/majd/ipatool
synced 2026-11-29 02:37:52 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a7adabbfa | ||
|
|
cfc4a075ae |
No files matched your search
@@ -1,5 +1,21 @@
|
||||
## Changelog
|
||||
|
||||
### Version [2.1.1](https://github.com/majd/ipatool/releases/tag/v2.1.1)
|
||||
|
||||
- Fixed an issue when creating the config directory for the tool.
|
||||
|
||||
### Version [2.1.0](https://github.com/majd/ipatool/releases/tag/v2.1.0)
|
||||
|
||||
- Implemented `Lookup` API.
|
||||
- Implemented `AccountInfo` API.
|
||||
- Implemented `ReplicateSinf` API.
|
||||
- Added storefront code for Georgia (GE).
|
||||
- Build version is now set using linker flags.
|
||||
- Refactored API interfaces.
|
||||
- Improved tests for http package.
|
||||
- Integrated `golangci-lint` linter.
|
||||
- Added v2 suffix to module path.
|
||||
|
||||
### Version [2.0.3](https://github.com/majd/ipatool/releases/tag/v2.0.3)
|
||||
|
||||
- Added support for downloading Apple Arcade games.
|
||||
|
||||
+6
-6
@@ -131,16 +131,16 @@ func initWithCommand(cmd *cobra.Command) {
|
||||
Machine: dependencies.Machine,
|
||||
})
|
||||
|
||||
util.Must("", createConfigDirectory())
|
||||
util.Must("", createConfigDirectory(dependencies.OS, dependencies.Machine))
|
||||
}
|
||||
|
||||
// createConfigDirectory creates the configuration directory for the CLI tool, if needed.
|
||||
func createConfigDirectory() error {
|
||||
configDirectoryPath := filepath.Join(dependencies.Machine.HomeDirectory(), ConfigDirectoryName)
|
||||
_, err := dependencies.OS.Stat(configDirectoryPath)
|
||||
func createConfigDirectory(os operatingsystem.OperatingSystem, machine machine.Machine) error {
|
||||
configDirectoryPath := filepath.Join(machine.HomeDirectory(), ConfigDirectoryName)
|
||||
_, err := os.Stat(configDirectoryPath)
|
||||
|
||||
if err != nil && dependencies.OS.IsNotExist(err) {
|
||||
err = dependencies.OS.MkdirAll(configDirectoryPath, 0700)
|
||||
if err != nil && os.IsNotExist(err) {
|
||||
err = os.MkdirAll(configDirectoryPath, 0700)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create config directory: %w", err)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package operatingsystem
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
@@ -27,60 +26,37 @@ func (operatingSystem) Getenv(key string) string {
|
||||
return os.Getenv(key)
|
||||
}
|
||||
|
||||
// nolint:wrapcheck
|
||||
func (operatingSystem) Stat(name string) (os.FileInfo, error) {
|
||||
info, err := os.Stat(name)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to describe file '%s': %w", name, err)
|
||||
}
|
||||
|
||||
return info, nil
|
||||
return os.Stat(name)
|
||||
}
|
||||
|
||||
// nolint:wrapcheck
|
||||
func (operatingSystem) Getwd() (string, error) {
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to get current directory: %w", err)
|
||||
}
|
||||
|
||||
return wd, nil
|
||||
return os.Getwd()
|
||||
}
|
||||
|
||||
// nolint:wrapcheck
|
||||
func (operatingSystem) OpenFile(name string, flag int, perm os.FileMode) (*os.File, error) {
|
||||
file, err := os.OpenFile(name, flag, perm)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to open file '%s': %w", name, err)
|
||||
}
|
||||
|
||||
return file, nil
|
||||
return os.OpenFile(name, flag, perm)
|
||||
}
|
||||
|
||||
// nolint:wrapcheck
|
||||
func (operatingSystem) Remove(name string) error {
|
||||
err := os.Remove(name)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to remove file '%s': %w", name, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
return os.Remove(name)
|
||||
}
|
||||
|
||||
// nolint:wrapcheck
|
||||
func (operatingSystem) IsNotExist(err error) bool {
|
||||
return os.IsNotExist(err)
|
||||
}
|
||||
|
||||
// nolint:wrapcheck
|
||||
func (operatingSystem) MkdirAll(path string, perm os.FileMode) error {
|
||||
err := os.MkdirAll(path, perm)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create directory '%s': %w", path, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
return os.MkdirAll(path, perm)
|
||||
}
|
||||
|
||||
// nolint:wrapcheck
|
||||
func (operatingSystem) Rename(oldPath, newPath string) error {
|
||||
err := os.Rename(oldPath, newPath)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to rename '%s' to '%s': %w", oldPath, newPath, err)
|
||||
}
|
||||
|
||||
return nil
|
||||
return os.Rename(oldPath, newPath)
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package operatingsystem
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"math/rand"
|
||||
@@ -70,7 +69,7 @@ var _ = Describe("OperatingSystem", func() {
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
|
||||
_, err = sut.Stat(file.Name())
|
||||
Expect(os.IsNotExist(errors.Unwrap(err))).To(BeTrue())
|
||||
Expect(os.IsNotExist(err)).To(BeTrue())
|
||||
})
|
||||
|
||||
It("renames file", func() {
|
||||
|
||||
Reference in new issue
Block a user