mirror of
https://github.com/IBM/fp-go.git
synced 2025-07-13 01:20:14 +02:00
fix: remove File.GetName and add Join for convenience
Signed-off-by: Dr. Carsten Leue <carsten.leue@de.ibm.com>
This commit is contained in:
@ -19,7 +19,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
|
|
||||||
RIOE "github.com/IBM/fp-go/context/readerioeither"
|
RIOE "github.com/IBM/fp-go/context/readerioeither"
|
||||||
FL "github.com/IBM/fp-go/file"
|
|
||||||
F "github.com/IBM/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
IO "github.com/IBM/fp-go/io"
|
IO "github.com/IBM/fp-go/io"
|
||||||
IOF "github.com/IBM/fp-go/io/file"
|
IOF "github.com/IBM/fp-go/io/file"
|
||||||
@ -32,7 +31,7 @@ var (
|
|||||||
// destroy handler
|
// destroy handler
|
||||||
onReleaseTempFile = F.Flow4(
|
onReleaseTempFile = F.Flow4(
|
||||||
IOF.Close[*os.File],
|
IOF.Close[*os.File],
|
||||||
IO.Map(FL.GetName),
|
IO.Map((*os.File).Name),
|
||||||
RIOE.FromIO[string],
|
RIOE.FromIO[string],
|
||||||
RIOE.Chain(Remove),
|
RIOE.Chain(Remove),
|
||||||
)
|
)
|
||||||
|
@ -15,9 +15,11 @@
|
|||||||
|
|
||||||
package file
|
package file
|
||||||
|
|
||||||
import "os"
|
import "path/filepath"
|
||||||
|
|
||||||
// GetName is the getter for the `Name` property of [os.File]
|
// Join appends a filename to a root path
|
||||||
func GetName(f *os.File) string {
|
func Join(name string) func(root string) string {
|
||||||
return f.Name()
|
return func(root string) string {
|
||||||
|
return filepath.Join(root, name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ package file
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
FL "github.com/IBM/fp-go/file"
|
|
||||||
F "github.com/IBM/fp-go/function"
|
F "github.com/IBM/fp-go/function"
|
||||||
IO "github.com/IBM/fp-go/io"
|
IO "github.com/IBM/fp-go/io"
|
||||||
IOF "github.com/IBM/fp-go/io/file"
|
IOF "github.com/IBM/fp-go/io/file"
|
||||||
@ -33,7 +32,7 @@ var (
|
|||||||
// destroy handler
|
// destroy handler
|
||||||
onReleaseTempFile = F.Flow4(
|
onReleaseTempFile = F.Flow4(
|
||||||
IOF.Close[*os.File],
|
IOF.Close[*os.File],
|
||||||
IO.Map(FL.GetName),
|
IO.Map((*os.File).Name),
|
||||||
IOE.FromIO[error, string],
|
IOE.FromIO[error, string],
|
||||||
IOE.Chain(Remove),
|
IOE.Chain(Remove),
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user