Skip to content

Commit

Permalink
refactor(Files): Improve function name
Browse files Browse the repository at this point in the history
  • Loading branch information
lgmarchi committed Jan 11, 2024
1 parent 20f81aa commit 7bace92
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const PREFIX_TO_WORK_ON_WINDOWS_OS: &str = "http://dioxus.";

/// This function is used to treat local file path if it needs
/// to be loaded in img or video tags for example
pub fn treat_paths_to_load_local_files(path: PathBuf) -> String {
pub fn get_fixed_path_to_load_local_file(path: PathBuf) -> String {
if !cfg!(target_os = "windows") {
path.to_string_lossy().to_string()
} else {
Expand Down
2 changes: 1 addition & 1 deletion common/src/utils/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub mod img_dimensions_preview;
pub mod lifecycle;
pub mod treat_paths_to_load_local_files;
pub mod local_file_path;
4 changes: 2 additions & 2 deletions kit/src/components/embeds/file_embed/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use common::utils::img_dimensions_preview::IMAGE_MAX_HEIGHT;
use common::utils::img_dimensions_preview::IMAGE_MAX_WIDTH;
use common::utils::lifecycle::use_component_lifecycle;
use common::STATIC_ARGS;
use common::utils::treat_paths_to_load_local_files::treat_paths_to_load_local_files;
use common::utils::local_file_path::get_fixed_path_to_load_local_file;
use dioxus_html::input_data::keyboard_types::Modifiers;

use dioxus::prelude::*;
Expand Down Expand Up @@ -205,7 +205,7 @@ pub fn FileEmbed<'a>(cx: Scope<'a, Props<'a>>) -> Element<'a> {
if !temp_dir.exists() {
cx.props.on_press.call(Some(temp_dir.clone()));
}
let temp_file_path_as_string = treat_paths_to_load_local_files(temp_dir.clone());
let temp_file_path_as_string = get_fixed_path_to_load_local_file(temp_dir.clone());
rsx!(
Modal {
open: *fullscreen_preview.clone(),
Expand Down
4 changes: 2 additions & 2 deletions ui/src/components/files/file_preview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use common::language::get_local_text;
use common::state::State;
use common::utils::img_dimensions_preview::{IMAGE_MAX_HEIGHT, IMAGE_MAX_WIDTH};
use common::utils::lifecycle::use_component_lifecycle;
use common::utils::treat_paths_to_load_local_files::treat_paths_to_load_local_files;
use common::utils::local_file_path::get_fixed_path_to_load_local_file;
use common::STATIC_ARGS;
use common::{icons::outline::Shape as Icon, warp_runner::thumbnail_to_base64};
use dioxus::prelude::*;
Expand All @@ -28,7 +28,7 @@ pub fn FilePreview<'a>(cx: Scope<'a, Props<'a>>) -> Element<'a> {
if !temp_dir.exists() {
cx.props.on_download.call(Some(temp_dir.clone()));
}
let temp_file_path_as_string = treat_paths_to_load_local_files(temp_dir.clone());
let temp_file_path_as_string = get_fixed_path_to_load_local_file(temp_dir.clone());

use_component_lifecycle(
cx,
Expand Down

0 comments on commit 7bace92

Please sign in to comment.