Compare commits
6 Commits
5b2688e091
...
908ca1d769
Author | SHA1 | Date |
---|---|---|
Max Bradbury | 908ca1d769 | |
Max Bradbury | 7db845e03e | |
Max Bradbury | fa7361d20f | |
Max Bradbury | 3aad33189c | |
Max Bradbury | 6ac967c6d9 | |
Max Bradbury | 005c90adb0 |
3
TODO.md
3
TODO.md
|
@ -10,5 +10,8 @@
|
|||
* vinyl crackle
|
||||
* white noise?
|
||||
* fan
|
||||
* cat purr
|
||||
* café
|
||||
* rustling leaves
|
||||
* set a window icon
|
||||
* create a nice icon?
|
||||
|
|
29
src/main.rs
29
src/main.rs
|
@ -23,7 +23,8 @@ fn save_config(config: Config) {
|
|||
let mut config_path = dirs::config_dir()
|
||||
.expect("Couldn't find user config directory");
|
||||
|
||||
config_path.push("ruin/lull");
|
||||
config_path.push("ruin");
|
||||
config_path.push("lull");
|
||||
|
||||
if !config_path.exists() {
|
||||
std::fs::create_dir_all(&config_path)
|
||||
|
@ -46,7 +47,9 @@ fn load_config() -> Option<Config> {
|
|||
let mut config_path = dirs::config_dir()
|
||||
.expect("Couldn't find user config directory");
|
||||
|
||||
config_path.push("ruin/lull/lull.toml");
|
||||
config_path.push("ruin");
|
||||
config_path.push("lull");
|
||||
config_path.push("lull.toml");
|
||||
|
||||
let file = File::open(config_path);
|
||||
|
||||
|
@ -90,10 +93,11 @@ fn error_popup(message: &str) {
|
|||
popup.show_all();
|
||||
}
|
||||
|
||||
fn get_data_dir() -> PathBuf {
|
||||
fn get_sounds_dir() -> PathBuf {
|
||||
let mut data_dir = dirs::data_dir().expect("Couldn't find user data directory");
|
||||
|
||||
data_dir.push("ruin/lull");
|
||||
data_dir.push("ruin");
|
||||
data_dir.push("lull");
|
||||
|
||||
if !data_dir.exists() {
|
||||
std::fs::create_dir_all(&data_dir).expect("Couldn't create lull data directory");
|
||||
|
@ -119,7 +123,7 @@ fn build_ui(application: >k::Application) {
|
|||
|
||||
button_manage_sounds.connect_clicked(|_| {
|
||||
let mut file_manager = Command::new(file_manager());
|
||||
file_manager.arg(get_data_dir());
|
||||
file_manager.arg(get_sounds_dir());
|
||||
file_manager.output().unwrap();
|
||||
});
|
||||
|
||||
|
@ -143,7 +147,7 @@ fn build_ui(application: >k::Application) {
|
|||
|
||||
let device = rodio::default_output_device().unwrap();
|
||||
|
||||
let mut paths = std::fs::read_dir(get_data_dir())
|
||||
let mut paths = std::fs::read_dir(get_sounds_dir())
|
||||
.expect("Couldn't read lull sounds directory")
|
||||
.map(|res| res.map(|e| e.path()))
|
||||
.collect::<Result<Vec<_>, std::io::Error>>()
|
||||
|
@ -152,7 +156,14 @@ fn build_ui(application: >k::Application) {
|
|||
paths.sort();
|
||||
|
||||
for path in paths {
|
||||
let name: &str = path.file_stem().unwrap().to_str().unwrap();
|
||||
let name = 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)
|
||||
.expect("Couldn't open audio file");
|
||||
|
@ -223,6 +234,10 @@ fn build_ui(application: >k::Application) {
|
|||
}
|
||||
|
||||
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(
|
||||
Some("dev.tinybird.max.lull"),
|
||||
Default::default()
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
#!/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