Skip to content

Commit

Permalink
Fix windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
Geometrically committed Aug 14, 2024
1 parent 70abf8e commit 40aeb10
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
5 changes: 2 additions & 3 deletions apps/app-frontend/src/pages/Browse.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup>
import { computed, nextTick, ref, readonly, shallowRef, watch, onUnmounted } from 'vue'
import { computed, nextTick, ref, readonly, shallowRef, watch } from 'vue'
import { ClearIcon, SearchIcon, ClientIcon, ServerIcon, XIcon } from '@modrinth/assets'
import {
Pagination,
Expand All @@ -19,7 +19,6 @@ import { useBreadcrumbs } from '@/store/breadcrumbs'
import { get_categories, get_loaders, get_game_versions } from '@/helpers/tags'
import { useRoute, useRouter } from 'vue-router'
import SearchCard from '@/components/ui/SearchCard.vue'
import SplashScreen from '@/components/ui/SplashScreen.vue'
import { get as getInstance, get_projects as getInstanceProjects } from '@/helpers/profile.js'
import { convertFileSrc } from '@tauri-apps/api/tauri'
import { get_search_results } from '@/helpers/cache.js'
Expand Down Expand Up @@ -724,7 +723,7 @@ const isModProject = computed(() => ['modpack', 'mod'].includes(projectType.valu
class="pagination-before"
@switch-page="onSearchChange"
/>
<SplashScreen v-if="loading" />
<section v-if="loading" class="offline">Loading...</section>
<section v-else-if="offline && results.total_hits === 0" class="offline">
You are currently offline. Connect to the internet to browse Modrinth!
</section>
Expand Down
16 changes: 13 additions & 3 deletions packages/app-lib/src/state/dirs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,19 @@ impl DirectoryInfo {

#[cfg(windows)]
{
use std::os::windows::fs::MetadataExt;
Ok(old_dir.metadata()?.volume_serial_number()
== new_dir.metadata()?.volume_serial_number())
let old_dir = crate::util::io::canonicalize(old_dir)?;
let new_dir = crate::util::io::canonicalize(new_dir)?;

let old_component = old_dir.components().next();
let new_component = new_dir.components().next();

match (old_component, new_component) {
(
Some(std::path::Component::Prefix(old)),
Some(std::path::Component::Prefix(new)),
) => Ok(old.as_os_str() == new.as_os_str()),
_ => Ok(false),
}
}
}

Expand Down

0 comments on commit 40aeb10

Please sign in to comment.