return Path in data folder function (#953)

This commit is contained in:
supercoolspy
2025-06-28 15:02:58 -07:00
committed by GitHub
parent d16b0f98c2
commit 6a620e4a9e

View File

@@ -1,4 +1,4 @@
use std::{fs, path::Path, sync::Arc};
use std::{fs, path::Path, path::PathBuf, sync::Arc};
use crate::command::client_suggestions;
use pumpkin_util::{
@@ -61,9 +61,9 @@ impl Context {
/// # Returns
/// A string representing the path to the data folder.
#[must_use]
pub fn get_data_folder(&self) -> String {
let path = format!("./plugins/{}", self.metadata.name);
if !Path::new(&path).exists() {
pub fn get_data_folder(&self) -> PathBuf {
let path = Path::new("./plugins").join(self.metadata.name);
if !path.exists() {
fs::create_dir_all(&path).unwrap();
}
path