Skip to content

File locking problem on Windows XAMPP #19

Description

@Perlkonig

In my Grav plugin Count Views, I'm using the RocketTheme\Toolbox\File\File interface. The plugin works fine in *nix environments, but it doesn't work in Windows. (I've only tested under XAMPP. But I'm told it works under the Windows Subsystem for Linux.)

The problem is these lines here:

        // Open data file
        $datafh = File::instance($path);
        $datafh->lock();
        $data = Yaml::parse($datafh->content());
        if ($data === null) {
            $data = array();
        }

No matter what, $datafh->content() is returning null on Windows, even though it loaded the file fine on lines 63-66. The only difference is the file locking.

I added an if/then, and indeed the file is getting locked. And I can confirm that if I remove the lock() line, everything works as expected.

Any help appreciated. Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions