Hi!
I recently have written such function, probably it that you search.
public string DoRoutine(string Path, int xxx)
{
if (xxx != 1)
{
aFolders.Add(@Path + @"\");
}
DirectoryInfo di = new DirectoryInfo(@Path);
DirectoryInfo[] diArr = di.GetDirectories();
foreach (DirectoryInfo dri in diArr)
{
aFolders.Add(@dri.FullName + @"\");
DoRoutine(@dri.FullName, 1);
}
return null;
}
Try:
ArrayList aFolders = new ArrayList();
DoRoutine(Application.StartupPath, 0);
or remove a line:
DoRoutine(@dri.FullName, 1);
"Robert Magnusson" <RobertMagnusson@discussions.microsoft.com> wrote in
message news:AB480E5C-85DC-4F16-8F97-4B8C23A85A60@microsoft.com...
[quoted text, click to view] > Ron,
>
> Application.StartupPath returns the bin\Debug folder when running through
> the VS IDE. When installing the application on a clients machine I'd put
the
> exe in the 'root' folder and then have sub-folders beneath this (so
> Application.StartupPath would work at this stage). The problem I am
trying
> to get around (elegantly) is that the application (through the IDE) always
> ends up in the bin/Debug folder so relative paths (from in this case the
> csproj) are actually ../.. from the exe at design time. This may mean
that I
> have to have design-time specific code to handle the relative paths and
> 'production' code to handle it when running the exe. Sounds a bit
draconian
> to me.
>
> Rob
>
> "Ron" wrote:
>
> > "Robert Magnusson" <RobertMagnusson@discussions.microsoft.com> wrote in
> > message news:63EF111D-CA3D-4A16-B81B-307BA352E4EA@microsoft.com...
> > > Hi All,
> > >
> > > This is sure to be an easy question.
> > >
> > > I am wondering what the accepted standard is for referencing a
sub-folder
> > > below the application.exe folder? In VB6 you simply used App.Path and
> > > navigated from the folder indicated. In .Net, however, when running
> > through
> > > the IDE, this seems to return either the ...bin/debug or
....bin/release
> > > folder - in which case the 'sub-folders' are actually to be found in
the
> > > ../../ folder.
> > >
> > > What is the best way to find a folder beneath the .csproj folder to
ensure
> > > the code works at design/release and executable time?
> > >
> > <snip>
> >
> > Rob, for C#, look up the help on Application.StartupPath. I imagine it
would
> > be similar for VB.NET.
> >
> > HTH
> >
> > Ron.
> >
> >
> >