|
@ -1,4 +1,5 @@ |
|
|
import os |
|
|
import os |
|
|
|
|
|
import datetime |
|
|
from expertmm import * |
|
|
from expertmm import * |
|
|
|
|
|
|
|
|
#variables to eliminate from generator.py (and managed here centrally instead, so configuration is shared across minetest helper programs): |
|
|
#variables to eliminate from generator.py (and managed here centrally instead, so configuration is shared across minetest helper programs): |
|
@ -469,31 +470,23 @@ def load_world_and_mod_data(): |
|
|
|
|
|
|
|
|
if (not minetestinfo.contains("primary_world_path")) or is_missing_world: |
|
|
if (not minetestinfo.contains("primary_world_path")) or is_missing_world: |
|
|
print ("LOOKING FOR WORLDS IN " + minetestinfo.get_var("worlds_path")) |
|
|
print ("LOOKING FOR WORLDS IN " + minetestinfo.get_var("worlds_path")) |
|
|
for base_path, dirnames, filenames in os.walk(minetestinfo.get_var("worlds_path")): |
|
|
folder_path=minetestinfo.get_var("worlds_path") |
|
|
#for j in range(0,len(dirnames)): |
|
|
#if os.path.isdir(folder_path): |
|
|
# i = len(dirnames) - 0 - 1 |
|
|
world_count = 0 |
|
|
# if dirnames[i][0] == ".": |
|
|
index = 0 |
|
|
# print (" SKIPPING "+dirnames[i]) |
|
|
world_number = 0 |
|
|
# dirnames.remove_at(i) |
|
|
for sub_name in os.listdir(folder_path): |
|
|
world_count = 0 |
|
|
sub_path = os.path.join(folder_path, sub_name) |
|
|
for subdirname in dirnames: |
|
|
if sub_name[:1]!="." and os.path.isdir(sub_path): |
|
|
#print (" EXAMINING "+subdirname) |
|
|
world_count += 1 |
|
|
if subdirname[0]!=".": |
|
|
print (" " + sub_name + (" "*(30-len(sub_name))) + " <"+datetime.datetime.fromtimestamp(os.path.getmtime(sub_path)).strftime('%Y-%m-%d %H:%M:%S')+">") |
|
|
world_count += 1 |
|
|
if sub_name[0]!=".": |
|
|
index = 0 |
|
|
if (sub_name!="world") or (world_number==(world_count-1)): |
|
|
world_number = 0 |
|
|
if not auto_chosen_world: |
|
|
for subdirname in dirnames: |
|
|
default_world_path = sub_path #os.path.join(base_path, sub_name) # os.path.join(minetestinfo.get_var("worlds_path"), "try7amber") |
|
|
print (" "+subdirname) |
|
|
|
|
|
if subdirname[0]!=".": |
|
|
|
|
|
#if (index == len(dirnames)-1): # skip first one because the one on my computer is big |
|
|
|
|
|
if (subdirname!="world") or (world_number==(world_count-1)): |
|
|
|
|
|
default_world_path = os.path.join(base_path, subdirname) # os.path.join(minetestinfo.get_var("worlds_path"), "try7amber") |
|
|
|
|
|
auto_chosen_world = True |
|
|
auto_chosen_world = True |
|
|
break |
|
|
|
|
|
world_number += 1 |
|
|
world_number += 1 |
|
|
index += 1 |
|
|
index += 1 |
|
|
if auto_chosen_world: |
|
|
|
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
if is_missing_world: |
|
|
if is_missing_world: |
|
|
print("MISSING WORLD '"+minetestinfo.get_var("primary_world_path")+"'") |
|
|
print("MISSING WORLD '"+minetestinfo.get_var("primary_world_path")+"'") |
|
|