mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-07-24 17:20:51 +02:00
refactor(os): refactor EOL const (#427)
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
This commit is contained in:
@@ -11,6 +11,9 @@
|
||||
declare global {
|
||||
interface Window {
|
||||
__TAURI_INVOKE__: <T>(cmd: string, args?: unknown) => Promise<T>;
|
||||
__TAURI__: {
|
||||
os: { __eol: string };
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,18 +44,16 @@ type Arch =
|
||||
| "s390x"
|
||||
| "sparc64";
|
||||
|
||||
function isWindows(): boolean {
|
||||
return navigator.appVersion.includes("Win");
|
||||
}
|
||||
|
||||
/**
|
||||
* The operating system-specific end-of-line marker.
|
||||
* Returns the operating system-specific end-of-line marker.
|
||||
* - `\n` on POSIX
|
||||
* - `\r\n` on Windows
|
||||
*
|
||||
* @since 2.0.0
|
||||
* */
|
||||
const EOL = isWindows() ? "\r\n" : "\n";
|
||||
function eol() {
|
||||
return window.__TAURI__.os.__eol;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string describing the specific operating system in use.
|
||||
@@ -174,7 +175,7 @@ async function hostname(): Promise<string | null> {
|
||||
}
|
||||
|
||||
export {
|
||||
EOL,
|
||||
eol,
|
||||
platform,
|
||||
family,
|
||||
version,
|
||||
|
||||
Reference in New Issue
Block a user