From aa69bbb0a5b6a95214572459673de3d3c0dfdf36 Mon Sep 17 00:00:00 2001 From: Jamie Banks Date: Tue, 9 Jun 2026 13:36:36 +0100 Subject: [PATCH] feat: hide NFS option on Windows and refactor NFS implementation for build tagging --- frontend/src/main.js | 8 ++++++ .../protocols/nfs/{nfs.go => nfs_unix.go} | 2 ++ internal/protocols/nfs/nfs_windows.go | 27 +++++++++++++++++++ 3 files changed, 37 insertions(+) rename internal/protocols/nfs/{nfs.go => nfs_unix.go} (99%) create mode 100644 internal/protocols/nfs/nfs_windows.go diff --git a/frontend/src/main.js b/frontend/src/main.js index 2ef8e65..2c95fdd 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -16,6 +16,14 @@ function uuidv4() { } async function init() { + if (window.runtime && window.runtime.Environment) { + const env = await window.runtime.Environment(); + if (env.platform === 'windows') { + const nfsOpt = document.querySelector('#conn-protocol option[value="nfs"]'); + if (nfsOpt) nfsOpt.remove(); + } + } + await loadConnections(); await loadDirectory(currentConn, currentPath); diff --git a/internal/protocols/nfs/nfs.go b/internal/protocols/nfs/nfs_unix.go similarity index 99% rename from internal/protocols/nfs/nfs.go rename to internal/protocols/nfs/nfs_unix.go index 6e926f2..8f74ee2 100644 --- a/internal/protocols/nfs/nfs.go +++ b/internal/protocols/nfs/nfs_unix.go @@ -1,3 +1,5 @@ +//go:build !windows + package nfs import ( diff --git a/internal/protocols/nfs/nfs_windows.go b/internal/protocols/nfs/nfs_windows.go new file mode 100644 index 0000000..24b005d --- /dev/null +++ b/internal/protocols/nfs/nfs_windows.go @@ -0,0 +1,27 @@ +//go:build windows + +package nfs + +import ( + "fmt" + "io" + + "goexplore/internal/config" + "goexplore/internal/explorer" +) + +type NFSExplorer struct{} + +func New(c *config.ConnectionConfig, secret string) (*NFSExplorer, error) { + return nil, fmt.Errorf("NFS is not supported on Windows") +} + +func (e *NFSExplorer) Connect() error { return nil } +func (e *NFSExplorer) Disconnect() error { return nil } +func (e *NFSExplorer) ListDir(path string) ([]explorer.FileEntry, error) { return nil, nil } +func (e *NFSExplorer) Stat(path string) (explorer.FileEntry, error) { return explorer.FileEntry{}, nil } +func (e *NFSExplorer) MkDir(path string) error { return nil } +func (e *NFSExplorer) Delete(path string) error { return nil } +func (e *NFSExplorer) Rename(src, dst string) error { return nil } +func (e *NFSExplorer) ReadFile(path string) (io.ReadCloser, error) { return nil, nil } +func (e *NFSExplorer) WriteFile(path string, r io.Reader, size int64) error { return nil }