Closed Christopher-Hayes closed 3 years ago
I like the idea of this change as playcanvas-sync can be installed globally IIRC so it makes it a lot easier to switch between projects via going to different folders on the commandline.
Oh right, this tool doesn't have to be globally installed. I guess I'm so used to globally installed NPM tools, I went for that the moment I saw it and totally forgot it wasn't the only option. Yeah, I figured in the future if I started working on another project, the utility would be ready to go. Similarly, I often run into trouble with a project global config overwriting the config of another project, which can be confusing and hard to debug, which is why starting off with a separate pcconfig.json
for each project appealed to me.
Yeah, I agree. With your proposed change, having a config in each 'target' folder makes switch between projects really easy
Thank you for suggesting this. We've added this functionality in https://github.com/playcanvas/playcanvas-sync/pull/27 To make it safer for users running the tool without a global install, we require the flag PLAYCANVAS_USE_CWD_AS_TARGET in ~/.pcconfig to enable this. We've also added an error if the target directory is the same as the directory where the tool is installed. Closing this PR.
Motivation
I was attempting to run this code for the first time in a while on my machine and I was getting a
Error: could not find target directory: . Check capitalization.
error. It looks like the code expects aPLAYCANVAS_TARGET_DIR
from the.pcconfig
file. So, that makes adding a.pcconfig
with aPLAYCANVS_TARGET_DIR
a requirement for new users. From the language in the README, I had the impression that the.pcconfig
was optional.What's Changed
This PR adds a default to
PLAYCANVAS_TARGET_DIR
to use the CWD. That default only comes into play whenPLAYCANVAS_TARGET_DIR
is not set. Also, when the target dir was validated was moved down to be after defaults are set.Tested on
:heavy_check_mark: Ubuntu 20.04 :heavy_check_mark: Windows 11 (Git Bash) :construction: TODO - OS X
Fixes
Partially fixes #22