Skip to content
This repository was archived by the owner on Sep 3, 2025. It is now read-only.

Commit 6c81dae

Browse files
committed
FIXES AND SCRIPT DIRECTORIES + two_way_descendants
1 parent f65113b commit 6c81dae

File tree

9 files changed

+23
-13
lines changed

9 files changed

+23
-13
lines changed

creeper.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
port = 8080
22
two_way_sync = [
33
"ServerStorage",
4-
"ReplicatedStorage"
5-
]
4+
"ReplicatedStorage/SearchThis"
5+
]
6+
two_way_descendants = false
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"data": "Hello from CreeperCLI (json/module)"
2+
"data": "Hello from creeperCLI (json)a"
33
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
data = "hello world"

game/ServerStorage/amogus/ANOTHER SCRIPT.server.lua

Lines changed: 0 additions & 3 deletions
This file was deleted.

game/ServerStorage/amogus/Script.server.lua

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/filesystem.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ pub fn get_tree(root: &str) -> Vec<FileTree> {
4444
tree
4545
}
4646

47-
pub fn get_game_files() -> Vec<FileTree> {
47+
pub fn get_root_files(root: &str) -> Vec<FileTree> {
4848
let cwd = get_cwd();
49-
let game = format!("{cwd}\\game");
49+
let game = format!("{cwd}\\{root}");
5050
get_tree(game.as_str())
5151
}
5252

src/get.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ lazy_static! {
1010
}
1111

1212
pub async fn get() -> impl Responder {
13-
let mut tree = filesystem::get_game_files();
13+
let mut tree = filesystem::get_root_files("game");
1414

1515
let mut data = match GLOBAL_DATA.lock() {
1616
Ok(guard) => guard,

src/main.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
use colored::Colorize;
2+
use toml::Table;
23
use std::{io::stdin, path::Path};
3-
44
use filesystem::get_cwd;
55
use server::run_server;
6+
use lazy_static::lazy_static;
7+
use std::sync::Mutex;
68

79
mod filesystem;
810
mod get;
911
mod post;
1012
mod server;
1113
mod settings;
1214

15+
lazy_static! {
16+
pub static ref DIRECTORIES: Mutex<Table> = Mutex::new(Table::new());
17+
}
18+
1319
#[actix_web::main]
1420
async fn main() -> std::io::Result<()> {
1521
let cwd = get_cwd();
@@ -21,6 +27,13 @@ async fn main() -> std::io::Result<()> {
2127
for (name, value) in settings.iter() {
2228
match name.to_lowercase().as_str() {
2329
"port" => port = value.as_integer().unwrap_or(8080) as u16,
30+
"directories" => {
31+
let mut data = match DIRECTORIES.lock() {
32+
Ok(guard) => guard,
33+
Err(poisoned) => poisoned.into_inner(), // Recover from poisoned mutex
34+
};
35+
*data = value.as_table().unwrap_or(&Table::new()).clone();
36+
},
2437
_ => {}
2538
}
2639
}

src/post.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub async fn post(body: String) -> impl Responder {
2222

2323
return HttpResponse::Ok()
2424
.append_header((header::CONTENT_TYPE, "application/json"))
25-
.body(map_tree(filesystem::get_game_files()));
25+
.body(map_tree(filesystem::get_root_files("game")));
2626
} else if data[0] == "__SETTINGS__" {
2727
let cwd = get_cwd();
2828
if let Ok(settings) = get_settings(&cwd) {

0 commit comments

Comments
 (0)