asynqmon: Not working on Windows

Hi, great project. I’m trying using it on Windows, but can’t get it to work.

When running and trying to access the browser, the following error is displayed: open ui\build\index.html: file does not exist

I have done some diging and have found the problem, but don’t know the right “fix”, so for this reason I’m opening this issue instead of PR.

Basically on this line, filepath.Abs returns C:\ https://github.com/hibiken/asynqmon/blob/0eb9d88c5365d7f34c1a9ff61518a5075170bb41/main.go#L59

This causes problems with the check if is / https://github.com/hibiken/asynqmon/blob/0eb9d88c5365d7f34c1a9ff61518a5075170bb41/main.go#L65 There is a problem with filepath.Join as well, since it will use \ and GO embed.FS will not find the file then. https://golang.org/pkg/embed/#hdr-Directives

The path separator is a forward slash, even on Windows systems.

The only way I could get it to work was making the following changes:

p := r.URL.Path
if filepath.IsAbs(p) {
	p = srv.indexFilePath()
} else {
	p = path.Join(srv.staticDirPath, p)
}

// ...
func (srv *staticFileServer) indexFilePath() string {
	return path.Join(srv.staticDirPath, srv.indexFileName)
}

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 1
  • Comments: 15 (3 by maintainers)

Commits related to this issue

Most upvoted comments

这是来自QQ邮箱的假期自动回复邮件。您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

这是来自QQ邮箱的假期自动回复邮件。您好,我最近正在休假中,无法亲自回复您的邮件。我将在假期结束后,尽快给您回复。

@SkYNewZ thank you for the comment. There were some changes made to use the embed package since this issue has been created, so this issue may be stale. I’ll look into this issue once again soon when I have enough bandwidth.