diff options
| author | William Venner <[email protected]> | 2021-02-28 19:39:30 +0000 |
|---|---|---|
| committer | William Venner <[email protected]> | 2021-02-28 19:39:30 +0000 |
| commit | 8acfc7caad08be2c7d2ea57cafde402ac28ebbcf (patch) | |
| tree | 991d7a88e8b8cd3112e7149a7ab88237b6c98e7f | |
| parent | Remove redundant cast (diff) | |
| download | steamworks-rs-8acfc7caad08be2c7d2ea57cafde402ac28ebbcf.tar.xz steamworks-rs-8acfc7caad08be2c7d2ea57cafde402ac28ebbcf.zip | |
Add QueryResults::preview_url to get preview URL of UGC published file
| -rw-r--r-- | src/ugc.rs | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -745,6 +745,25 @@ impl<'a> QueryResults<'a> { self.num_results_returned } + /// Gets the preview URL of the published file at the specified index. + pub fn preview_url(&self, index: u32) -> Option<String> { + let mut url = [0 as libc::c_char; 4096]; + + let ok = unsafe { + sys::SteamAPI_ISteamUGC_GetQueryUGCPreviewURL(self.ugc, self.handle, index, url.as_mut_ptr(), url.len() as u32) + }; + + if ok { + Some(unsafe { + CStr::from_ptr(url.as_ptr() as *const _) + .to_string_lossy() + .into_owned() + }) + } else { + None + } + } + /// Gets a result. /// /// Returns None if index was out of bounds. |