Skip to content

Commit 98ff2bd

Browse files
committed
fixup! fixup! fixup! Trying to make it cross platform
1 parent 47fec9a commit 98ff2bd

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

roboflow/util/folderparser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def _list_files(folder):
5353
for file in files:
5454
file_path = os.path.join(root, file)
5555
rel = os.path.relpath(file_path, folder)
56-
filedescriptors.append(_describe_file(f"/{rel}"))
56+
filedescriptors.append(_describe_file(f"{os.sep}{rel}"))
5757
filedescriptors = sorted(
5858
filedescriptors,
5959
key=lambda x: _alphanumkey(x["file"]),
@@ -70,7 +70,7 @@ def _describe_file(f):
7070
name = os.path.basename(f)
7171
dirname = os.path.dirname(f)
7272
fullkey, extension = os.path.splitext(f)
73-
fullkey2 = fullkey.replace("/labels", "").replace("/images", "")
73+
fullkey2 = fullkey.replace(f"{os.sep}labels", "").replace(f"{os.sep}images", "")
7474
key = os.path.splitext(name)[0]
7575
return {
7676
"file": f,

tests/util/test_folderparser.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ def test_parse_sharks_coco(self):
1717
sharksfolder = f"{thisdir}/../datasets/sharks-tiny-coco"
1818
parsed = folderparser.parsefolder(sharksfolder)
1919
testImagePath = "/train/sharks_mp4-20_jpg.rf.90ba2e8e9ca0613f71359efb7ed48b26.jpg"
20+
print("PARSED", parsed["images"])
2021
testImage = [i for i in parsed["images"] if i["file"] == testImagePath][0]
2122
assert len(json.loads(testImage["annotationfile"]["rawText"])["annotations"]) == 5
2223

2324
def test_parse_sharks_createml(self):
2425
sharksfolder = f"{thisdir}/../datasets/sharks-tiny-createml"
2526
parsed = folderparser.parsefolder(sharksfolder)
27+
print("PARSED", parsed["images"])
2628
testImagePath = "/train/sharks_mp4-20_jpg.rf.5359121123e86e016401ea2731e47949.jpg"
2729
testImage = [i for i in parsed["images"] if i["file"] == testImagePath][0]
2830
imgParsedAnnotations = json.loads(testImage["annotationfile"]["rawText"])

0 commit comments

Comments
 (0)