I'm building a data transfer tool that may be deployed to either a Windows or Linux Docker container that must instruct SQL Server to take a database snapshot. Additionally, SQL Server may be on either Windows or Linux and I need to specify where on the server the .ss file will go. I've been using Path.GetFilenameWithoutExtension, Path.Combine, etc but Path operations are done in the context of the OS the app is running in. I need something like WindowsPath.Combine that I can run in Linux when I'm talking to a SQL Server instance on Windows. Right now I do my own string manipulation but I'd prefer to use Path or something purpose built if possible. I know what OS I'm running on and the OS SQL Server is running on and just need an OS agnostic Path.
How can I manipulate Windows paths from a Linux app and vice versa in .NET Core?
606 views Asked by Ben Campbell At
1
There are 1 answers
Related Questions in .NET-CORE
- Repository manager receives the wrong connection string in .net core
- How can I overwrite the localization strings in a library
- Custom type resolution
- How to enable log to console Cosmos Client SDK requests
- Issue with Entity Framework Core: .Include() and .AsNoTracking() not displaying expected related entities
- Using Python CDK to bundle dotnet 8 code to AWS Lambda function
- How to make Visual Studio 2022 project launch Windows Terminal instead of PowerShell?
- Custom Metrics stop saving in App Insight after one hour
- How to send select input data for form submission?
- When I use built-in DockerFile in Visual Studio, I see no errors, but when I try to create image and container using terminal I get an error
- Failure to Execute the DBCommand: SQLite Err. 1 - C# / .NET / Entity Framework Core
- KeyCloak Handshake causing timeout
- problemas con los CORS en .net core 7 y angular 15
- Access Registed Scoped Services and Transient Services using GetService()
- .NET Core DB vs JSON model design
Related Questions in CROSS-PLATFORM
- Error while connecting to discord WebSocket on specific platform
- How to store metadata for a UTF-8 text file cross-platform?
- JavaScript Web Audio API - Audio Sampling Rate Issue on Android
- Dynamic sizing and responsive design
- What unicode characters are generally displayable across browsers (using system fonts) and not showing missing glyphs?
- Python cross-platform software update mechanism like youtube-dl?
- Back button is not visible in maui, using Prism
- react native system compatibility issues
- Render local pdf reports in c# from .rdlc template for cross platform as using System.Drawing is not supported for non-windows platforms
- Options for building cross-platform applications using HTML as the GUI?
- ScrollView doesnt work in React Native horizontally
- Linking to .so with newer symbol
- Is there a way to create a GIF from network images in flutter?
- In my MAUI application, why when I programmatically add a rotated box to an AbsoluteLayout do I see 2 boxes. One is rotated and the other is not
- Animated components with 'fadeIn' animation making views behind them visible in android but working fine in iOS | React Native
Related Questions in PATH-SEPARATOR
- Do I need to escape a separator character in a file path in java
- Keep backslashes when passing path param in bash from powershell
- AppleScript: when concatenating a POSIX path a comma is inserted?
- when is it "safe" to mix path separators in Python strings representing Windows paths?
- string path to folders/file object javascript
- File.separator and "/" work differently in a runnable jar
- Why os.path.join returns result with 2 slashes?
- How to combine paths by preserving the original path's directory separator in C#?
- in R, invoke external program in path with spaces with command line parameters
- Use / for path on Windows, and have stdlib functions use it as well (glob, os.path, etc.)
- Problem with the python zipfile library if you share a file between linux and windows
- Path separator for Atom / JavaScript on Windows
- Why does root returned from os.walk() contain / as directory separator but os.sep (or os.path.sep) return \ on Win10?
- Shortening file paths using Python
- Why Doesn't Dividing a path by the Default Constructed path Just add a Trailing Separator in Visual Studio?
Related Questions in PATH-MANIPULATION
- fortify: path manipulation in c#
- How to prevent "Path manipulation" issues in C#, .net core For below statment getting error
- .NET Fortify Path Manipulation
- Path manipulation issue in spring boot
- How can I find the potential source environment variable for a partial path in PowerShell?
- Path Manipulation Fortify Security Remediation
- Python Handle Fortify Path Manipulation
- Path manipulation issue report by fortify scan
- How can I manipulate Windows paths from a Linux app and vice versa in .NET Core?
- Powershell: Edit the drive letter of all my shortcuts that begin with X:\
- Input parameter sanitization in android for avoiding vulnerabilities
- Fortify : Path Manipulation in C - White List Implementation doesn't work - fopen issue
- How to avoid path traversal security vulnerability
- Python Scripts + Use of folders and paths
- How to to resolve issue Fortify path manipulation
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
I think you'll need to make your own class of static functions to do Windows specific path manipulation. "C:\MyDir\MyFile.ext" can actually be the name of a file on Linux.
You can look at various implementations of .NET Path and you can see that it is just using string manipulation:
https://github.com/microsoft/referencesource/blob/master/mscorlib/system/io/path.cs
I suggest just starting with the methods you need. For example: