mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-20 17:41:37 +00:00
Add support for serving non-project files directly
This commit is contained in:
parent
171ab196c8
commit
e2761965d5
1 changed files with 12 additions and 1 deletions
|
|
@ -322,6 +322,13 @@ pub struct Project {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Project {
|
impl Project {
|
||||||
|
pub fn is_project_file(path: &Path) -> bool {
|
||||||
|
path.file_name()
|
||||||
|
.and_then(|name| name.to_str())
|
||||||
|
.map(|name| name.ends_with(".project.json"))
|
||||||
|
.unwrap_or(false)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn init_place(project_fuzzy_path: &Path) -> Result<PathBuf, ProjectInitError> {
|
pub fn init_place(project_fuzzy_path: &Path) -> Result<PathBuf, ProjectInitError> {
|
||||||
let project_path = Project::pick_path_for_init(project_fuzzy_path)?;
|
let project_path = Project::pick_path_for_init(project_fuzzy_path)?;
|
||||||
|
|
||||||
|
|
@ -418,7 +425,11 @@ impl Project {
|
||||||
|
|
||||||
// If this is a file, assume it's the config the user was looking for.
|
// If this is a file, assume it's the config the user was looking for.
|
||||||
if location_metadata.is_file() {
|
if location_metadata.is_file() {
|
||||||
|
if Project::is_project_file(start_location) {
|
||||||
return Some(start_location.to_path_buf());
|
return Some(start_location.to_path_buf());
|
||||||
|
} else {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
} else if location_metadata.is_dir() {
|
} else if location_metadata.is_dir() {
|
||||||
let with_file = start_location.join(PROJECT_FILENAME);
|
let with_file = start_location.join(PROJECT_FILENAME);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue