The order is determined by the sort() method used in this line of code 10, which might be OS-dependent. In your example, cat would most likely be class0 and dog class1 and you can check it via the dataset.class_to_index attribute.
However, there were differences on Windows and Linux in the sorting of names starting with numbers.
If I remember correctly, you would have to prepend zeros to the name to get the same sorting:
00001
00002
00003
...
00010
00011