-4

So I'm trying to find a way of accesing the path of the folder to copy files but I can't find a way to do it

string folderpath = "C:\Users\Marc Vila\Downloads\Version 3.5\WindowsForm1\WindowsForm1/Resources";

I don't want to do that because as soon as I move it it gives me an error, anyone knows a more efficient way to do it? Thanks and regards

Note: I've tried System.IO but it gives me a lot of trouble

Marc Vila
  • 11
  • 5
  • What "error"? What "trouble"? You're assigning a string value to a variable, nothing more. What/where is the actual problem? – David Jan 15 '18 at 19:07
  • 1
    Copying to a project forlder at runtime wont make them available via Resources, if that is what you are trying. Posts like this give us *a lot of trouble* – Ňɏssa Pøngjǣrdenlarp Jan 15 '18 at 19:07
  • not sure if these are the issues: 1. missing the escape sign, 2. missing the "\" at the end, 3. "/" in the path, typo? – LONG Jan 15 '18 at 19:18
  • So my problem is that calling a folder by fullpath works on my computer, but if i send this to someone that won't work because they will have another path to their resource folder, I'm trying to get a 'general' way to call my resource folder without naming the WHOLE path. – Marc Vila Jan 15 '18 at 19:24
  • Sorry if my post gave you a lot of trouble, I'm just trying to get things figured out. Thanks – Marc Vila Jan 15 '18 at 19:24

1 Answers1

1

You need to get the assembly's path and then build a relative path on top of that.

Take the code from this answer and then use that to combine the paths:

var folderPath = Path.Combine(AssemblyDirectory, "Resources");
John Koerner
  • 37,428
  • 8
  • 84
  • 134