mirror of
https://github.com/jkl1337/duplicacy.git
synced 2026-01-02 11:44:45 -06:00
Fix some deprecated functions in windows code
This commit is contained in:
@@ -6,7 +6,7 @@ package duplicacy
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"os"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
@@ -86,7 +86,7 @@ func keyringGet(key string) (value string) {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
description, err := ioutil.ReadFile(keyringFile)
|
description, err := os.ReadFile(keyringFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
LOG_DEBUG("KEYRING_READ", "Keyring file not read: %v", err)
|
LOG_DEBUG("KEYRING_READ", "Keyring file not read: %v", err)
|
||||||
return ""
|
return ""
|
||||||
@@ -125,7 +125,7 @@ func keyringSet(key string, value string) bool {
|
|||||||
|
|
||||||
keyring := make(map[string][]byte)
|
keyring := make(map[string][]byte)
|
||||||
|
|
||||||
description, err := ioutil.ReadFile(keyringFile)
|
description, err := os.ReadFile(keyringFile)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
err = json.Unmarshal(description, &keyring)
|
err = json.Unmarshal(description, &keyring)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -160,7 +160,7 @@ func keyringSet(key string, value string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ioutil.WriteFile(keyringFile, description, 0600)
|
err = os.WriteFile(keyringFile, description, 0600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
LOG_DEBUG("KEYRING_WRITE", "Failed to save the keyring storage to file %s: %v", keyringFile, err)
|
LOG_DEBUG("KEYRING_WRITE", "Failed to save the keyring storage to file %s: %v", keyringFile, err)
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -56,7 +56,11 @@ const (
|
|||||||
|
|
||||||
// Readlink returns the destination of the named symbolic link.
|
// Readlink returns the destination of the named symbolic link.
|
||||||
func Readlink(path string) (isRegular bool, s string, err error) {
|
func Readlink(path string) (isRegular bool, s string, err error) {
|
||||||
fd, err := syscall.CreateFile(syscall.StringToUTF16Ptr(path), FILE_READ_ATTRIBUTES,
|
pPath, err := syscall.UTF16PtrFromString(path)
|
||||||
|
if err != nil {
|
||||||
|
return false, "", err
|
||||||
|
}
|
||||||
|
fd, err := syscall.CreateFile(pPath, FILE_READ_ATTRIBUTES,
|
||||||
syscall.FILE_SHARE_READ, nil, syscall.OPEN_EXISTING,
|
syscall.FILE_SHARE_READ, nil, syscall.OPEN_EXISTING,
|
||||||
syscall.FILE_FLAG_OPEN_REPARSE_POINT|syscall.FILE_FLAG_BACKUP_SEMANTICS, 0)
|
syscall.FILE_FLAG_OPEN_REPARSE_POINT|syscall.FILE_FLAG_BACKUP_SEMANTICS, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user