Skip to content

Commit

Permalink
cross platform
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Dec 2, 2023
1 parent 3faab77 commit 7067e6f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions caddy/caddy.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func (f *FrankenPHPModule) Provision(ctx caddy.Context) error {
if frankenphp.EmbeddedAppPath == "" {
f.Root = "{http.vars.root}"
} else {
f.Root = frankenphp.EmbeddedAppPath + defaultDocumentRoot
f.Root = filepath.Join(frankenphp.EmbeddedAppPath, defaultDocumentRoot)
f.ResolveRootSymlink = false
}
} else {
Expand Down Expand Up @@ -442,7 +442,7 @@ func parsePhpServer(h httpcaddyfile.Helper) ([]httpcaddyfile.ConfigValue, error)

if frankenphp.EmbeddedAppPath != "" {
if phpsrv.Root == "" {
phpsrv.Root = frankenphp.EmbeddedAppPath + defaultDocumentRoot
phpsrv.Root = filepath.Join(frankenphp.EmbeddedAppPath, defaultDocumentRoot)
fsrv.Root = phpsrv.Root
phpsrv.ResolveRootSymlink = false
} else if filepath.IsLocal(fsrv.Root) {
Expand Down
2 changes: 1 addition & 1 deletion caddy/php-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func cmdPHPServer(fs caddycmd.Flags) (int, error) {

if frankenphp.EmbeddedAppPath != "" {
if root == "" {
root = frankenphp.EmbeddedAppPath + defaultDocumentRoot
root = filepath.Join(frankenphp.EmbeddedAppPath, defaultDocumentRoot)
} else if filepath.IsLocal(root) {
root = filepath.Join(frankenphp.EmbeddedAppPath, root)
}
Expand Down
3 changes: 1 addition & 2 deletions embed.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"embed"
_ "embed"
"encoding/hex"
"fmt"
"io/fs"
"os"
"path/filepath"
Expand Down Expand Up @@ -43,7 +42,7 @@ func init() {

// TODO: use XXH3 instead of MD5
h := md5.Sum([]byte(e))
appPath := fmt.Sprintf("%sfrankenphp_%s/", os.TempDir(), hex.EncodeToString(h[:]))
appPath := filepath.Join(os.TempDir(), "frankenphp_"+hex.EncodeToString(h[:]))

if err := os.RemoveAll(appPath); err != nil {
panic(err)
Expand Down

0 comments on commit 7067e6f

Please sign in to comment.