Preference file changes for Vista/Win7, network installations, and large domain deployments #21808

Closed
opened 2010-03-28 22:43:07 +02:00 by Harley Acheson · 8 comments
Member

%%%This patch changes the default location to where the user preference file, ".b25.blend", is stored on Windows computers.

Currently the "b25" file is stored in the ".blender" sub-directory of the program installation. By having the file in there it requires that the user have write access to the folder, which precludes sharing the program folder on a network drive. It also means that the user must run with administrator privileges under Vista and Windows 7. These two problems make it difficult to support Blender on a large domain, like those found at a university or big company.

Instead, this patch alters the preference loading behavior to look for "b25" in the user's "appdata" folder, normally at somewhere like:
C:\Documents and Settings\username\Application Data\Blender Foundation\Blender

If it does not find the file there it then uses the one in the installation ".blender" folder. This way initial defaults can be stored in the program folder by a network administrator, but every user can still have their own settings.

This patch only affects Windows users, but I have left some comments in where similar paths can be set for Mac and Linux.

I realize that there is code in the gethome function in pathutil that reads the appdata path for Windows. Unfortunately that code is broken (will almost never get executed) and I don't think it should be fixed. That code would move the entire ".blend" folder to a new location, including the scripts. What really needs to be moved are just the per-user files that require write access.

If this patch is accepted, I was going to go down this road even further. I would make another patch so that Blender could use a custom Group Policy so that some of these settings can be published to users through the Windows domain group policies mechanisms. This is pretty trivial--I would just need to add a routine to read some HKEY_CU registry entries, and I would supply an ADM file, just a couple k is size, that can be installed on a Windows 200x domain controller.

Regards, Harley Acheson
%%%

%%%This patch changes the default location to where the user preference file, ".b25.blend", is stored on Windows computers. Currently the "b25" file is stored in the ".blender" sub-directory of the program installation. By having the file in there it requires that the user have write access to the folder, which precludes sharing the program folder on a network drive. It also means that the user must run with administrator privileges under Vista and Windows 7. These two problems make it difficult to support Blender on a large domain, like those found at a university or big company. Instead, this patch alters the preference loading behavior to look for "b25" in the user's "appdata" folder, normally at somewhere like: C:\Documents and Settings\username\Application Data\Blender Foundation\Blender If it does not find the file there it then uses the one in the installation ".blender" folder. This way initial defaults can be stored in the program folder by a network administrator, but every user can still have their own settings. This patch only affects Windows users, but I have left some comments in where similar paths can be set for Mac and Linux. I realize that there is code in the gethome function in pathutil that reads the appdata path for Windows. Unfortunately that code is broken (will almost never get executed) and I don't think it should be fixed. That code would move the entire ".blend" folder to a new location, including the scripts. What really needs to be moved are just the per-user files that require write access. If this patch is accepted, I was going to go down this road even further. I would make another patch so that Blender could use a custom Group Policy so that some of these settings can be published to users through the Windows domain group policies mechanisms. This is pretty trivial--I would just need to add a routine to read some HKEY_CU registry entries, and I would supply an ADM file, just a couple k is size, that can be installed on a Windows 200x domain controller. Regards, Harley Acheson %%%
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Member

%%%Could you read and comment:
http://wiki.blender.org/index.php/Dev:2.5/Source/ResourceFilePaths
http://wiki.blender.org/index.php/Dev:2.5/Source/Architecture/EnvironmentVariables
and look at
source/blender/blenlib/intern/BLI_bfile.c

Now that someone from MSWindows land seems avaliable, I think the plan can get
further review and go ahead if all OK. I needed someone that could help with
the values in that OS (Plisson helps with MacOSX and I do Unix).%%%

%%%Could you read and comment: http://wiki.blender.org/index.php/Dev:2.5/Source/ResourceFilePaths http://wiki.blender.org/index.php/Dev:2.5/Source/Architecture/EnvironmentVariables and look at source/blender/blenlib/intern/BLI_bfile.c Now that someone from MSWindows land seems avaliable, I think the plan can get further review and go ahead if all OK. I needed someone that could help with the values in that OS (Plisson helps with MacOSX and I do Unix).%%%
Member

%%%Hi Harley,

I just took a look at your patch. I have no complaints code wise everything is ok.
From the current usage of the BLI_Gethome, I also think it is safe to also move the '.Bfs' and '.Blog' files to use the BLI_getpreferencesfolder - the .Bfs is the 'bookmarks' for the user and the .Blog is the recent file list.

Right now, we are discussing a bit on how to distribute and search for the different files that blender uses and writes, so it is also likely that things might change around as Matt Ebb is coordinating development in that area.

I have put my thoughts on the whole issue here:
http://wiki.blender.org/index.php/Dev:2.5/Source/ResourceFilePaths#Some_feedback_and_further_thoughts:_.5BElubie.5D

So if you like to go ahead and add the other configuration files I'll certainly try and see if your patch fits with the general direction we are going, but I can't say at this point unfortunately whether your patch will be used as is.

I would like to invite you to participate in the discussion though, on the mailing list or on IRC, my nick is elubie and Matt Ebb is matt_e.

Thanks for your contribution,
Andrea%%%

%%%Hi Harley, I just took a look at your patch. I have no complaints code wise everything is ok. From the current usage of the BLI_Gethome, I also think it is safe to also move the '.Bfs' and '.Blog' files to use the BLI_getpreferencesfolder - the .Bfs is the 'bookmarks' for the user and the .Blog is the recent file list. Right now, we are discussing a bit on how to distribute and search for the different files that blender uses and writes, so it is also likely that things might change around as Matt Ebb is coordinating development in that area. I have put my thoughts on the whole issue here: http://wiki.blender.org/index.php/Dev:2.5/Source/ResourceFilePaths#Some_feedback_and_further_thoughts:_.5BElubie.5D So if you like to go ahead and add the other configuration files I'll certainly try and see if your patch fits with the general direction we are going, but I can't say at this point unfortunately whether your patch will be used as is. I would like to invite you to participate in the discussion though, on the mailing list or on IRC, my nick is elubie and Matt Ebb is matt_e. Thanks for your contribution, Andrea%%%
Author
Member

%%%Sorry for the delay. I’ve opened up about 10 hours a week for Blender stuff, but I find myself spending a lot of time just exploring through the source.

Anyway, I had added support to deal the same with the “.blog” and “.bfs” files, and with the “autosaves” folder while I was at it. Then I ran into a snag. Although the “.blog” was being properly created, wrote to, and read it was not showing up in the UI on the File menu correctly. This is because the python there is calling the “wrong” function and using the old location.

I had only made a new function, getpreferencesfolder, so I could deal with the “.b25.blend” file separately from the rest so nothing else would be broken. If I were to carry on and do the same for all the files in the “.blender” folder then eventually the “BLI_gethome” function would become deprecated, replaced by these new functions.

However, if we are now talking about moving “b25.blend”, “.bfs”, “.blog”, and the “autosaves” folder then this is everything in the “.blender” folder (I think) except for “scripts” and “python”. I think I should try to just make these changes in “BLI_gethome” and then deal with “scripts” and “python” separately. I’ll take a look tonight and see if this will work a bit nicer.

One dumb question though…
On Linux and Mac there is a system-wide environment variable called “HOME” that gives the user’s home folder, which is normally seen as “~/”. In the current source, in Path_Util, it looks like this is used as the base path for files like “.b25.blend”. I had assumed that those files were in a “~/.blender/” folder and I don’t see that in the source. Do you run Linux yourself to confirm? If not I might just have to make a Linux machine.
%%%

%%%Sorry for the delay. I’ve opened up about 10 hours a week for Blender stuff, but I find myself spending a lot of time just exploring through the source. Anyway, I had added support to deal the same with the “.blog” and “.bfs” files, and with the “autosaves” folder while I was at it. Then I ran into a snag. Although the “.blog” was being properly created, wrote to, and read it was not showing up in the UI on the File menu correctly. This is because the python there is calling the “wrong” function and using the old location. I had only made a new function, getpreferencesfolder, so I could deal with the “.b25.blend” file separately from the rest so nothing else would be broken. If I were to carry on and do the same for all the files in the “.blender” folder then eventually the “BLI_gethome” function would become deprecated, replaced by these new functions. However, if we are now talking about moving “b25.blend”, “.bfs”, “.blog”, and the “autosaves” folder then this is everything in the “.blender” folder (I think) except for “scripts” and “python”. I think I should try to just make these changes in “BLI_gethome” and then deal with “scripts” and “python” separately. I’ll take a look tonight and see if this will work a bit nicer. One dumb question though… On Linux and Mac there is a system-wide environment variable called “HOME” that gives the user’s home folder, which is normally seen as “~/”. In the current source, in Path_Util, it looks like this is used as the base path for files like “.b25.blend”. I had assumed that those files were in a “~/.blender/” folder and I don’t see that in the source. Do you run Linux yourself to confirm? If not I might just have to make a Linux machine. %%%
Member

%%%Hi Harley,

Just to maybe clarify, the .Bfs, .Blog and autosaves folder are the files in the .blender folder that are user specific, so this is why it makes sense to separate them out into a user specific directory.

The idea is to move the BLI_gethome calls for the .Bfs .Blog and autosaves etc. to somthing like getUserDir and the rest (python scripts, languages) to use getSystemDir and thus eventually removing the joint BLI_gethome function to retrieve those directories.
This will enable us to separate out these files at installation and make sure that Blender doesn't have to write to the installation directory.

And yes, it looks like on Linux and MAC the .B.25 are written directly into the users home directory - this should maybe discussed with the Linux guys whether it should be kept.

As for the problem with the python, if you have a patch with the rest, I can check and fix that I think.

  • Andrea
    %%%
%%%Hi Harley, Just to maybe clarify, the .Bfs, .Blog and autosaves folder are the files in the .blender folder that are user specific, so this is why it makes sense to separate them out into a user specific directory. The idea is to move the BLI_gethome calls for the .Bfs .Blog and autosaves etc. to somthing like getUserDir and the rest (python scripts, languages) to use getSystemDir and thus eventually removing the joint BLI_gethome function to retrieve those directories. This will enable us to separate out these files at installation and make sure that Blender doesn't have to write to the installation directory. And yes, it looks like on Linux and MAC the .B.25 are written directly into the users home directory - this should maybe discussed with the Linux guys whether it should be kept. As for the problem with the python, if you have a patch with the rest, I can check and fix that I think. - Andrea %%%
Author
Member

%%%I sure of what to do with a revised patch so I just added a new file here called "patch-harley-pref-changes2.txt". In keeping with the conversations and documents about all this I changed the name of this new function to "BLI_getuserbasefolder" from "BLI_getpreferencesfolder". It will now read an environment variable "BLENDER_USER_BASE" as per that related document. I also added comments to where I would later add support for setting the path via Windows Group Policy.

".Bfs" files work as expected. The ".blog" is properly saved to, and read from. However, this is not reflected properly in the UI because "space_info.py" reads the file from "bpy.app.home" and I didn't want to tackle that.

While I was in "wm.files.c" I also changed one line in wm_autosave_location. It will create the "autosave" folder in our userbase, like the other user files, instead of the blender installation. However, this is only ever done if the folder specified by "U.tempdir" doesn't exist, and that is quite often "\tmp" for some reason. Personally I'd rather take out the check for "U.tempdir" and just have "autosave" created in our userbase folder.
%%%

%%%I sure of what to do with a *revised* patch so I just added a new file here called "patch-harley-pref-changes2.txt". In keeping with the conversations and documents about all this I changed the name of this new function to "BLI_getuserbasefolder" from "BLI_getpreferencesfolder". It will now read an environment variable "BLENDER_USER_BASE" as per that related document. I also added comments to where I would later add support for setting the path via Windows Group Policy. ".Bfs" files work as expected. The ".blog" is properly saved to, and read from. However, this is not reflected properly in the UI because "space_info.py" reads the file from "bpy.app.home" and I didn't want to tackle that. While I was in "wm.files.c" I also changed one line in wm_autosave_location. It will create the "autosave" folder in our userbase, like the other user files, instead of the blender installation. However, this is only ever done if the folder specified by "U.tempdir" doesn't exist, and that is quite often "\tmp" for some reason. Personally I'd rather take out the check for "U.tempdir" and just have "autosave" created in our userbase folder. %%%
Member

%%%Since 2.53 Beta the usage of folders has changed entirely. I think it supersedes the work from this patch.

Closing.%%%

%%%Since 2.53 Beta the usage of folders has changed entirely. I think it supersedes the work from this patch. Closing.%%%
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#21808
No description provided.