Compare commits
No commits in common. "908ca1d7693636dc094f678bd3478cfd8324b1dc" and "5b2688e0919712114d70102fef048d962124db1e" have entirely different histories.
908ca1d769
...
5b2688e091
3
TODO.md
3
TODO.md
|
@ -10,8 +10,5 @@
|
||||||
* vinyl crackle
|
* vinyl crackle
|
||||||
* white noise?
|
* white noise?
|
||||||
* fan
|
* fan
|
||||||
* cat purr
|
|
||||||
* café
|
|
||||||
* rustling leaves
|
|
||||||
* set a window icon
|
* set a window icon
|
||||||
* create a nice icon?
|
* create a nice icon?
|
||||||
|
|
29
src/main.rs
29
src/main.rs
|
@ -23,8 +23,7 @@ fn save_config(config: Config) {
|
||||||
let mut config_path = dirs::config_dir()
|
let mut config_path = dirs::config_dir()
|
||||||
.expect("Couldn't find user config directory");
|
.expect("Couldn't find user config directory");
|
||||||
|
|
||||||
config_path.push("ruin");
|
config_path.push("ruin/lull");
|
||||||
config_path.push("lull");
|
|
||||||
|
|
||||||
if !config_path.exists() {
|
if !config_path.exists() {
|
||||||
std::fs::create_dir_all(&config_path)
|
std::fs::create_dir_all(&config_path)
|
||||||
|
@ -47,9 +46,7 @@ fn load_config() -> Option<Config> {
|
||||||
let mut config_path = dirs::config_dir()
|
let mut config_path = dirs::config_dir()
|
||||||
.expect("Couldn't find user config directory");
|
.expect("Couldn't find user config directory");
|
||||||
|
|
||||||
config_path.push("ruin");
|
config_path.push("ruin/lull/lull.toml");
|
||||||
config_path.push("lull");
|
|
||||||
config_path.push("lull.toml");
|
|
||||||
|
|
||||||
let file = File::open(config_path);
|
let file = File::open(config_path);
|
||||||
|
|
||||||
|
@ -93,11 +90,10 @@ fn error_popup(message: &str) {
|
||||||
popup.show_all();
|
popup.show_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_sounds_dir() -> PathBuf {
|
fn get_data_dir() -> PathBuf {
|
||||||
let mut data_dir = dirs::data_dir().expect("Couldn't find user data directory");
|
let mut data_dir = dirs::data_dir().expect("Couldn't find user data directory");
|
||||||
|
|
||||||
data_dir.push("ruin");
|
data_dir.push("ruin/lull");
|
||||||
data_dir.push("lull");
|
|
||||||
|
|
||||||
if !data_dir.exists() {
|
if !data_dir.exists() {
|
||||||
std::fs::create_dir_all(&data_dir).expect("Couldn't create lull data directory");
|
std::fs::create_dir_all(&data_dir).expect("Couldn't create lull data directory");
|
||||||
|
@ -123,7 +119,7 @@ fn build_ui(application: >k::Application) {
|
||||||
|
|
||||||
button_manage_sounds.connect_clicked(|_| {
|
button_manage_sounds.connect_clicked(|_| {
|
||||||
let mut file_manager = Command::new(file_manager());
|
let mut file_manager = Command::new(file_manager());
|
||||||
file_manager.arg(get_sounds_dir());
|
file_manager.arg(get_data_dir());
|
||||||
file_manager.output().unwrap();
|
file_manager.output().unwrap();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -147,7 +143,7 @@ fn build_ui(application: >k::Application) {
|
||||||
|
|
||||||
let device = rodio::default_output_device().unwrap();
|
let device = rodio::default_output_device().unwrap();
|
||||||
|
|
||||||
let mut paths = std::fs::read_dir(get_sounds_dir())
|
let mut paths = std::fs::read_dir(get_data_dir())
|
||||||
.expect("Couldn't read lull sounds directory")
|
.expect("Couldn't read lull sounds directory")
|
||||||
.map(|res| res.map(|e| e.path()))
|
.map(|res| res.map(|e| e.path()))
|
||||||
.collect::<Result<Vec<_>, std::io::Error>>()
|
.collect::<Result<Vec<_>, std::io::Error>>()
|
||||||
|
@ -156,14 +152,7 @@ fn build_ui(application: >k::Application) {
|
||||||
paths.sort();
|
paths.sort();
|
||||||
|
|
||||||
for path in paths {
|
for path in paths {
|
||||||
let name = path.file_stem().unwrap().to_str().unwrap();
|
let name: &str = path.file_stem().unwrap().to_str().unwrap();
|
||||||
let extension = path.extension().unwrap().to_str().unwrap();
|
|
||||||
|
|
||||||
// on Windows the data dir and config dir are the same,
|
|
||||||
// so avoid parsing the config file as an audio file
|
|
||||||
if extension == "toml" {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
let file = File::open(&path)
|
let file = File::open(&path)
|
||||||
.expect("Couldn't open audio file");
|
.expect("Couldn't open audio file");
|
||||||
|
@ -234,10 +223,6 @@ fn build_ui(application: >k::Application) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// instantiate rodio before gtk and don't do anything with it
|
|
||||||
// this is silly but it's the easiest way to prevent cpal crashing on windows
|
|
||||||
rodio::default_output_device().unwrap();
|
|
||||||
|
|
||||||
let application = gtk::Application::new(
|
let application = gtk::Application::new(
|
||||||
Some("dev.tinybird.max.lull"),
|
Some("dev.tinybird.max.lull"),
|
||||||
Default::default()
|
Default::default()
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
export PKG_CONFIG_ALLOW_CROSS=1
|
|
||||||
export PKG_CONFIG_PATH=/usr/i686-w64-mingw32/lib/pkgconfig
|
|
||||||
rm -rf package
|
|
||||||
docker start lull-build-3 -ai | less
|
|
Loading…
Reference in New Issue