Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Vscode's method of using relative paths

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail the methods of using relative paths in vscode. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

How does vscode use relative paths

The relative paths in vscode are different from those in general editors. For specific differences, please refer to the following table.

The symbol vscode general ". / 2.txt" relative to the working path (the location of the .vscode folder) relative to the current running file "2.txt" relative to the working path relative to the current running file "/ 2.txt" relative to the disk root directory

Examples of use:

Requirements: the work path is as above, the execution file is readfile .py, and the 1.txt file needs to be obtained.

Solution 1: use the corresponding relative path

That is, according to the work path to find the relative path is ". / greatProject/godsearch/1.txt"

Solution 2: change the launch.json settings

Add a statement to configurations

"cwd": "${fileDirname}"

It can be changed into a conventional relative path mode.

To get the relative path, you only need ". / 1.txt" or "1.txt".

This is the end of this article on "vscode's method of using relative paths". I hope the above content can be helpful to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report