Skip to content
Snippets Groups Projects
Commit e6c16e8d authored by Jeremy Soller's avatar Jeremy Soller
Browse files

hack to get all entries to show up with ralloc

parent 162e17a0
No related branches found
No related tags found
No related merge requests found
...@@ -6,7 +6,8 @@ extern crate orbimage; ...@@ -6,7 +6,8 @@ extern crate orbimage;
extern crate orbfont; extern crate orbfont;
use std::env; use std::env;
use std::fs::{self, File}; use std::fs::File;
use std::path::Path;
use std::process::Command; use std::process::Command;
use std::thread; use std::thread;
...@@ -44,16 +45,26 @@ fn get_display_size() -> (i32, i32) { ...@@ -44,16 +45,26 @@ fn get_display_size() -> (i32, i32) {
} }
fn get_packages() -> Vec<Package> { fn get_packages() -> Vec<Package> {
let mut packages: Vec<Package> = Vec::new(); let read_dir = Path::new("/apps/").read_dir().expect("failed to read_dir on /apps/");
for entry_result in fs::read_dir("/apps/").unwrap() { let mut entries = vec![];
let entry = entry_result.unwrap(); for dir in read_dir {
if entry.file_type().unwrap().is_dir() { let dir = match dir {
packages.push(Package::from_path(&("/apps/".to_string() + entry.file_name().to_str().unwrap()))); Ok(x) => x,
Err(_) => continue,
};
let file_name = dir.file_name().to_string_lossy().into_owned();
if dir.file_type().expect("failed to get file_type").is_dir() {
entries.push(file_name);
} }
} }
packages.sort_by(|a, b| a.name.cmp(&b.name)); entries.sort();
let mut packages: Vec<Package> = Vec::new();
for entry in entries.iter() {
packages.push(Package::from_path(&format!("/apps/{}", entry)));
}
packages packages
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment