Open / Save to cloud on Windows 10

Linus Torvalds torvalds at linux-foundation.org
Mon Feb 20 09:47:15 PST 2017


On Mon, Feb 20, 2017 at 9:41 AM, Dirk Hohndel <dirk at hohndel.org> wrote:
>
> How about writing a wrapper function that can be called from C in
> qthelper.cpp (we have quite a few of them there already) and have that do
> something like
>
> extern "C" bool dir_exists(const char *dir)
> {
>         return QDir(dir).exists();
> }

So we do actually want more than to check if it's a directory. We use
"stat()" for two things in the git wrapper:

 - to check the existing cache:

    if it's a directorty, we uupdate it

 - if it's a non-directory,. we do warnings/cleanup

 - if it doesn't exist, we may create it.

So that code actually wants at least a ternary return value, or just a
regular stat() like it does now.

Then in is_git_repository() we do indeed just want to know "does this
directory exist".

We *could* just use our existing "subsurface_open() + fstat()", which
is already a pattern we use, but doing "open()" on a directory ends up
being one of those things I could easily see not working under Windows
either.

                     Linus


More information about the subsurface mailing list