In C#, how do I combine more than two parts of a file path at once?

Here’s a utility method you can use: public static string CombinePaths(string path1, params string[] paths) { if (path1 == null) { throw new ArgumentNullException(“path1”); } if (paths == null) { throw new ArgumentNullException(“paths”); } return paths.Aggregate(path1, (acc, p) => Path.Combine(acc, p)); } Alternate code-golf version (shorter, but not quite as clear, semantics are a bit … Read more

How do I change the local path of a subfolder in TFS (not the whole workspace)?

If you want to change the local path for the working directory of the Team Foundation Server (TFS), you need to go to File -> Source Control -> Workspaces (File -> Source Control -> Advanced -> Workspaces for VS2017), then select your workspace (it should match your computer name) and click Edit. In the next … Read more

Dockerfile: COPY / ADD with space character in path (Windows)

Maybe you can use ARG to help you, like this: Dockerfile: FROM jfloff/alpine-python:2.7 ARG src=”https://stackoverflow.com/questions/56420386/Folder 1/File.txt” ARG target=”Dir 1/” COPY ${src} ${target} BTW, a / has to be add at the end of Dir 1 if you treat really want to treat it as a folder. And, JSON format is also ok, just you miss … Read more

How can I get the url pathname on a server component next js 13

Take a look at https://github.com/vercel/next.js/issues/43704 , pauliusuza solved this issue You can do a workaround using a middleware import { NextResponse } from ‘next/server’; export function middleware(request: Request) { // Store current request url in a custom header, which you can read later const requestHeaders = new Headers(request.headers); requestHeaders.set(‘x-url’, request.url); return NextResponse.next({ request: { // … Read more

C# – How to extract the file name and extension from a path?

System.IO has different classes to work with files and directories. Between them, one of the most useful one is Path which has lots of static helper methods for working with files and folders: Path.GetExtension(yourPath); // returns .exe Path.GetFileNameWithoutExtension(yourPath); // returns File Path.GetFileName(yourPath); // returns File.exe Path.GetDirectoryName(yourPath); // returns C:\Program Files\Program

Cygwin – command not found

Right click on “My Computer” -> Properties -> Advanced -> Environment Variables Add a new environment variable, called CYGWIN_HOME and set its value to C:\cygwin Edit the PATH environment variable and add %CYGWIN_HOME%\bin to it (usually separated by a ‘;’). Just click okay, exit any command prompts or bash shells (over cygwin) you may have … Read more

PyCharm: Anaconda installation is not found

There is an open bug, currently PyCharm and IDEA both seem to detect Conda installation only from %HOMEPATH%/anaconda. https://youtrack.jetbrains.com/issue/PY-26923 The easiest workaround is to create a symlink to $HOME/.anaconda mklink /D %HOMEDRIVE%%HOMEPATH%\anaconda C:\ProgramData\Anaconda3 Note that C:\ProgramData\Anaconda3 should be replaced with the path to your Anconda installation. If you selected to installed it for “Just Me” … Read more