Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📝 Use Steam app names instead of folder names #11

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Running `lnshot` will generate a set of [symbolic links](https://en.wikipedia.or
```
📂 ~/Pictures/Steam Screenshots
└ 📂 Ticky
├ 📂 Hardspace Shipbreaker
├ 📂 Hardspace: Shipbreaker
│ └ 🌌 20221020102933_1.jpg
├ 📂 Need for Speed: Most Wanted
│ └ 🌃 20221005164632_1.jpg
Expand Down Expand Up @@ -41,7 +41,7 @@ Instead of this:

`lnshot` can detect Steam's installation directory, and automatically find your Pictures folder across all three supported Steam platforms.

User folders are generated for each Steam user logged into your system (filtering is not yet supported). Game folders will be named after your game title for non-Steam shortcuts, and named the same as the `steamapps/common` installation folder for games managed by Steam, which is usually a reasonable name. This may change to use the full Steam app name in the future.
User folders are generated for each Steam user logged into your system (filtering is not yet supported). Game folders will be named after each game's title.

`lnshot` does this offline, using only the metadata Steam already has stored on your hard disk.

Expand Down
22 changes: 11 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use anyhow::{Context, Result};
use clap::{Parser, Subcommand};
use directories::UserDirs;
use steamid_ng::SteamID;
use steamlocate::{SteamDir};
use steamlocate::SteamDir;

/// Symlink your Steam games' screenshot directories into your Pictures folder
#[derive(Parser, Debug)]
Expand Down Expand Up @@ -124,16 +124,16 @@ fn main() -> Result<()> {
);

let symlink_name = if let Some(Some(app)) = steam_apps.get(&(appid as u32)) {
app.path
.file_name()
.with_context(|| "Failed to retrieve file name from install path")?
app.name
.clone()
.with_context(|| "Failed to retrieve Steam app name")?
} else if let Some(shortcut) = steam_shortcuts.iter().find(|shortcut| {
u64::from(shortcut.appid & 0x7fffff) == appid
|| shortcut.steam_id() == appid
}) {
std::ffi::OsStr::new(&shortcut.app_name)
shortcut.app_name.to_string()
} else {
std::ffi::OsStr::new(appid_str)
appid_str.to_string()
};

let target_symlink_path = target_screenshots_dir.join(symlink_name);
Expand Down Expand Up @@ -355,16 +355,16 @@ fn main() -> Result<()> {
let steam_shortcuts = steam_dir.shortcuts();

let symlink_name = if let Some(Some(app)) = steam_apps.get(&(appid as u32)) {
app.path
.file_name()
.with_context(|| "Failed to retrieve file name from install path")?
app.name
.clone()
.with_context(|| "Failed to retrieve Steam app name")?
} else if let Some(shortcut) = steam_shortcuts.iter().find(|shortcut| {
u64::from(shortcut.appid & 0x7fffff) == appid
|| shortcut.steam_id() == appid
}) {
std::ffi::OsStr::new(&shortcut.app_name)
shortcut.app_name.to_string()
} else {
std::ffi::OsStr::new(&appid_str)
appid_str.to_string()
};

let target_symlink_path = target_screenshots_dir.join(symlink_name);
Expand Down