• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 406
  • Last Modified:

Full Path of Given Folder

Hi

I have a folder that's in my project structure (windows form-based application project)

How do I get it's full path with code?

Please check attached illustration
folder.png
0
alfardan
Asked:
alfardan
  • 2
  • 2
  • 2
  • +2
3 Solutions
 
Ronak PatelCommented:
Dim directory as String = My.Application.Info.DirectoryPath

OR

Dim fullPath as String = Path.GetFullPath(Application.ExecutablePath)

Open in new window

0
 
BuggyCoderCommented:
Dim iconsFolder As String
iconsFolder = Path.Combine(Directly.GetCurrentDirectory(), "icons");

Open in new window


Refer here for more details:-
http://stackoverflow.com/questions/2996246/how-do-i-get-path-of-the-directory-inside-my-winform-app-project
0
 
alfardanAuthor Commented:
All suggested codes give me the execution folder of the application

The icons folder is not there when I'm running the application in debug mode
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Rose BabuSenior Team ManagerCommented:
Dim iconsPath As String = ""
' if Build output path is bin\Debug\
iconsPath = Application.StartupPath.Replace("\bin\Debug", "\icons")

' if Build output path is bin\Release\
iconsPath = Application.StartupPath.Replace("\bin\Release", "\icons")

Open in new window

Try this.

FYI,

when you publish your application as an exe or creating a setup file, you will add the bin\Debug\ or bin\Release\ folder's files alone.
in this case if you access the folder outside bin\Debug\ or bin\Release\ folder will not work.

so better, create the icons folder in bin\Debug\ or bin\Release\ folder and access that using
Dim iconsPath As String = ""
iconsPath = Application.StartupPath & "\icons"

Open in new window

0
 
käµfm³d 👽Commented:
The icons folder is not there when I'm running the application in debug mode
I would think that you would want this available to the end application when you build the project, so (within that folder) have you set the files' "Copy to Output" as "Copy Always" (or "Copy if Newer")? If you make the files part of the output, then the above solutions would work fine.
0
 
alfardanAuthor Commented:
kaufmed

How do I do this "Copy Always" to the folder "icons"?
0
 
käµfm³d 👽Commented:
You simply need to do it to the pertinent files under the folder--the folder will be created in the output directory if there are any child files which have been marked as mentioned above.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now