NetTalk Central

Author Topic: NT Paths - trying to sort this out  (Read 2696 times)

rjolda

  • Sr. Member
  • ****
  • Posts: 337
    • View Profile
    • Email
NT Paths - trying to sort this out
« on: January 22, 2024, 07:08:34 AM »
Hi All,
NT 14.13  C 11.0.136
I am trying to get a handle on PATHS for a web server.   Right now,  I am working only with the WebServer.AppPath .  All my files are in the same directory as my Web Server exe.
I am going to have a different folder for each user. i.e.  User 1 will have folder: C:\User1  and User 2 will have the folder C:\User2. 
I was going to use the SETPATH() once each user logs in and I know their specific folder.  e.g. SeTPATH('C:\User1')  or SetPath('C:\User2').  In this way, they will only see their data.  I know that the NT training book uses Variable file names but I would like to use the Setpath() to get to each data set.
Questions: 1. Is using SetPath() a valid approach to do this?
                2. If  User1 is in C:\User1 directory and UPLOADS a file to the server.   Where will it go?   WIll it go to .web\uploads relative to where the App EXE is running or will User 1 have an UpLoads directory in C:\User1

I have the option of making USER 1 and USER 2 folders beneath the web folder so I am not all over the disk - is that preferable?   
Thanks for any insight.
Ron

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11263
    • View Profile
Re: NT Paths - trying to sort this out
« Reply #1 on: January 23, 2024, 06:37:28 AM »
Hi Ron,

>> I was going to use the SETPATH() once each user logs in and I know their specific folder.  e.g. SeTPATH('C:\User1')  or SetPath('C:\User2').  In this way, they will only see their data.  I know that the NT training book uses Variable file names but I would like to use the Setpath() to get to each data set.

You absolutely cannot use SETPATH to do this. The "current directory" is a non-threaded environment variable. Since multiple users can be logged in at the same time, Environment variables cannot be used at the user level.

>> I know that the NT training book uses Variable file names

you'll be shocked to know, there's a reason for that.

>> Questions: 1. Is using SetPath() a valid approach to do this?

nope.

>>  2. If  User1 is in C:\User1 directory and UPLOADS a file to the server.   Where will it go? 

\web\uploads
(or wherever you direct it to in your code.)

>>  WIll it go to .web\uploads relative to where the App EXE is running

the \web folder is already independent of the exe folder. So there's no web folder "relative" to the exe folder. That doesn't exist.
it will go to the \web\uploads folder though (or to wherever you redirect it to.)

>> or will User 1 have an UpLoads directory in C:\User1

no. the server will not serve to, or from, folders outside the web folder. The _database_ files may of course be anywhere (since their location is determined by the file driver, not the WebServer class). They are unrelated to the\web folder, and putting database files int eh \web\ folder would be very bad.


>> I have the option of making USER 1 and USER 2 folders beneath the web folder so I am not all over the disk - is that preferable?   

For uploads, sure. For database files, not that would be very bad.

Cheers
Bruce