Skip to content

Commit d98d644

Browse files
committed
Don't call exist() on a directory when reading Annotated's metadata.
This might not work for "filesystems" that don't have a concept of a directory. Instead, check for the existence of OBJECT files inside the directory.
1 parent 4de41fd commit d98d644

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jaspagate",
3-
"version": "0.1.5",
3+
"version": "0.1.6",
44
"description": "Read and save objects in the takane format. This is a Javascript equivalent to the alabaster (R) and dolomite (Python) frameworks.",
55
"author": {
66
"name": "Aaron Lun",

src/globals.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export class GlobalsInterface {
2323

2424
/**
2525
* @param {string} path - Local path to a file, see {@linkcode GlobalsInterface#get get} for details.
26+
* Note that this should not be a path to a directory;
27+
* developers of {@linkcode readObject} functions should check for the existence of particular files inside a directory, rather than the directory itself.
2628
* @return {boolean|Promise<boolean>} Whether the `path` exists.
2729
*/
2830
exists(path) {

src/metadata.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { readObject, saveObject, readObjectFile } from "./general.js";
22

33
export async function readAnnotatedMetadata(path, globals, options, optname) {
4-
if (!(await globals.exists(path))) {
4+
if (!(await globals.exists(path + "/OBJECT"))) { // check existence of file, not directory.
55
return {};
66
}
77

0 commit comments

Comments
 (0)