Skip to content

fix(cfapi): SHChangeNotify inopérant — trailing backslash manquant sur le chemin dossier #154

Description

@CCoupel

Symptôme

Créations et copies via GhD: → le fichier est bien présent en local mais l'Explorateur Windows ne se rafraîchit pas (nécessite F5).

Root cause

NotifyLocalChange dans notify_windows.go :

dir := filepath.Dir(localPath)  // ex: "C:\GhostDrive\Backend"
C.ghd_notify_dir_change(wDir)   // SHChangeNotify(SHCNE_UPDATEDIR, SHCNF_PATH, dir, NULL)

SHChangeNotify(SHCNE_UPDATEDIR, SHCNF_PATH, ...) sur Windows requiert que le chemin dossier se termine par un backslash. Sans cela, le shell ignore silencieusement la notification.

De plus, les appels depuis handleRemoteEvent passaient filepath.Dir(localPath) (déjà un dossier) à NotifyLocalChange qui en refaisait un filepath.Dir → chemin du dossier parent du parent (grand-parent).

Fix

internal/cfapi/notify_windows.go :

if !strings.HasSuffix(dir, string(filepath.Separator)) {
    dir += string(filepath.Separator)
}

internal/sync/engine.go handleRemoteEvent :
Passer localPath (fichier) au lieu de filepath.Dir(localPath) pour que NotifyLocalChange calcule lui-même le dossier parent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendCode Go / moteur de synchronisationbugSomething isn't workingwindows-apiCloud Filter API, WinFsp, placeholders

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions