Skip to content

feat: add windows compatibility (#133) #223

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

listeng
Copy link

@listeng listeng commented Apr 17, 2025

add windows compatibility (#133)

  1. Use the filepath.ToSlash() function to ensure slash normalization.
  2. Temporarily replace (:) with ($) symbols in Win.
  3. Force utf8 in Win to avoid garbage string.
  4. Compatible paths for python executable programs in Win.

@Yeuoly
Copy link
Collaborator

Yeuoly commented Apr 19, 2025

I intent to move all the compatible code to a generic function like ToOsCompatPluginPath etc, it returns plugin_unique_identifier depends on the specific OS, so that we can also add tests for it to ensure the robust.

As for .venv/Script/python.exe, we can do the same optimization, the path should be returned by another function, instead of handing it inside InitPythonEnvironment

@@ -32,7 +33,11 @@ func (p *LocalPluginRuntime) InitPythonEnvironment() error {
os.RemoveAll(path.Join(p.State.WorkingPath, ".venv"))
} else {
// setup python interpreter path
pythonPath, err := filepath.Abs(path.Join(p.State.WorkingPath, ".venv/bin/python"))
pythonExec := ".venv/bin/python"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be simplify to p.getVenvPythonExecPath()

@@ -22,28 +23,44 @@ func (b *InstalledBucket) Save(
plugin_unique_identifier plugin_entities.PluginUniqueIdentifier,
file []byte,
) error {
return b.oss.Save(filepath.Join(b.installedPath, plugin_unique_identifier.String()), file)
compat_plugin_unique_identifier := plugin_unique_identifier.String()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same code snippet repeats many times, I want it to be an util function

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 this pull request may close these issues.

2 participants