Skip to content

Commit

Permalink
ref: only create via xcodeproj_folder
Browse files Browse the repository at this point in the history
  • Loading branch information
kkharji committed Jun 21, 2022
1 parent b5ddde2 commit c93e7c0
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#![deny(rustdoc::broken_intra_doc_links)]
#![doc = include_str!("../README.md")]

use anyhow::{bail, Context, Result};
use anyhow::Result;
use pbxproj::PBXRootObject;
use std::path::{Path, PathBuf};

Expand All @@ -23,25 +23,8 @@ pub struct XCodeProject {
}

impl XCodeProject {
/// Create new XCodeProject object from project root
pub fn new<P: AsRef<Path>>(root: P) -> Result<Self> {
let matches = wax::walk("*.xcodeproj", &root)
.context("Glob")?
.flatten()
.map(|entry| entry.into_path())
.collect::<Vec<PathBuf>>();

let path = if matches.is_empty() {
bail!("No Xcodeproj found at {:#?}", root.as_ref());
} else {
&matches[0]
};

Self::new_from_xcodeproj_folder(path)
}

/// Create new XCodeProject object from xcodeproj_folder
pub fn new_from_xcodeproj_folder<P: AsRef<Path>>(xcodeproj_folder: P) -> Result<Self> {
pub fn new<P: AsRef<Path>>(xcodeproj_folder: P) -> Result<Self> {
let xcodeproj_folder = xcodeproj_folder.as_ref();
let pbxproj_path = xcodeproj_folder.join("project.pbxproj");

Expand Down

0 comments on commit c93e7c0

Please sign in to comment.