Skip to content

phinx init results in directory is not writable when path contains OneDrive #2343

@MichaelMrt

Description

@MichaelMrt

Problem

I tried to follow the Installation guide from the docs and couldn't get past
vendor/bin/phinx init

The Issue I got is:

In Init.php line 146:

  The directory "C:\path\to\myrepo" is not writable  


init [-f|--format FORMAT] [--] [<path>]

What I tried

After looking at line 146:
if (!is_writable($dirname)) {

I separately tested the is_writable() method in php
php -r "echo is_writable('C:\\path\\to\\myrepo') ? 'Writable' : 'Not writable';"
and the result was Not writable.

Then I tested creating a file and writing into it with php
php -r "if(file_put_contents('C:\\path\\to\\myrepo\\phpwritten.txt','test')) { echo 'Success'; } else { echo 'Error';
and it worked.

After some testing I found out the Onedrive part is making the is_writable() method return false.
C:\Users\myuser\OneDrive - company\myrepo

Workaround

After using a path without OneDrive in it everything worked.
Also removing line 146 lead to a successful creation of the phinx.php file

Maybe there is a way to fix this or add a note in the docs like in #116 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions