1 package CloudStore::JSON;
11 warn "### VFS make_path $_[0]\n";
12 File::Path::make_path(@_);
16 warn "### VFS remove_path $_[0]\n";
17 File::Path::remove_tree(@_);
21 warn "### VFS unlink $_[0]\n";
26 warn "### VFS write_file $_[0]\n";
27 File::Slurp::write_file(@_);
31 warn "### VFS modify_existing $_[0]\n";
36 my $json = encode_json $data;
38 my $path = "users/$data->{login}/json/$data->{file}";
40 if ( $data->{itemize} =~ m/^[c>]([fd])/ ) { # received change/create
43 modify_existing $path;
48 if ( $path =~ m{^(.+)/[^/]+$} ) { # have dir
49 make_path $1 if ! -e $1;
51 write_file $path, $json;
52 } elsif ( $type eq 'd' ) {
55 } elsif ( $data->{itemize} =~ m/\*deleting/ ) {
58 } elsif ( -f $path ) {