Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding windows support #12

Closed
strangebug opened this issue Aug 24, 2017 · 3 comments · Fixed by #18
Closed

Adding windows support #12

strangebug opened this issue Aug 24, 2017 · 3 comments · Fixed by #18

Comments

@strangebug
Copy link
Contributor

Hi,

First of all, great work 👍

I was wandering if you would consider a PR or making a few modification to add windows support. Actually, it almost support compilation on windows right off the bat. The only thing preventing it is a unix syscall in segment-readonly.go.

	if unix.Access(cwd, unix.W_OK) != nil {
		p.appendSegment("perms", segment{
			content:    fmt.Sprintf(" %s ", p.symbolTemplates.Lock),
			foreground: p.theme.ReadonlyFg,
			background: p.theme.ReadonlyBg,
		})
	}

So I made the modification

	const W_USR = 0002
	// Check user's permissions on directory in a portable but probably slower way
	fileInfo, _ := os.Stat(cwd)
	if fileInfo.Mode()&W_USR != W_USR {
		p.appendSegment("perms", segment{
			content:    fmt.Sprintf(" %s ", p.symbolTemplates.Lock),
			foreground: p.theme.ReadonlyFg,
			background: p.theme.ReadonlyBg,
		})
	}

and it seems to work just fine (at least if you're using git-bash).

powerline_gitbash_windows

I made the change by adding a specific implementation for windows so I'm sure it doesn't break anything for Unix users. But it's not really necessary, what's your thought about that ?

It is not thoroughly tested but I don't mind testing some more and submit a PR ;-)

More details

@strangebug
Copy link
Contributor Author

After installing a proper font from https://github.com/powerline/fonts. No more glitches ;)

powerline-go

@justjanne
Copy link
Owner

Could you open a Pull Request for this?

@strangebug
Copy link
Contributor Author

Sure, done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants