From f5fd29391cbcf2a0e75b42c288e6513d000b6b2c Mon Sep 17 00:00:00 2001 From: Binary Date: Tue, 4 Feb 2025 17:00:41 -0400 Subject: [PATCH] Finally working on mobile --- manifest.json | 2 +- src/pathController.ts | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/manifest.json b/manifest.json index c66f40f..d9db588 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "bin-theme-controller", "name": "Theme Controller", - "version": "1.0.4", + "version": "1.0.5", "minAppVersion": "0.15.0", "description": "Set when and how the themes will be displayed.", "author": "Binaris", diff --git a/src/pathController.ts b/src/pathController.ts index 13785fd..c261795 100644 --- a/src/pathController.ts +++ b/src/pathController.ts @@ -1,4 +1,4 @@ -import { App, TFile } from "obsidian"; +import { App, TFile, Plugin } from 'obsidian'; import ThControl from "./main"; import { IThControlSettings } from "./settings/settings"; import * as path from 'path-browserify'; @@ -44,9 +44,14 @@ export class PathController { export function isPathInside(basePath: string, targetPath: string): number { - const normalizedBase = path.resolve(basePath); - const normalizedTarget = path.resolve(targetPath); + let normalizedBase = basePath + let normalizedTarget = targetPath + if(!app.isMobile){ + normalizedBase = path.resolve(basePath); + normalizedTarget = path.resolve(targetPath); + } + if (normalizedTarget.startsWith(normalizedBase + path.sep)) { const baseParts = normalizedBase.split(path.sep); const targetParts = normalizedTarget.split(path.sep);