user profile manipulation
Published: Dec 15, 2020 - 1:54 PM
Hello,
I'm trying to install a Firefox update package from version 52.9esr to Firefox 68.9esr.
The problem is that this version upgrade creates a new default user profile.
The idea is to back up the file C:\Users\Username\AppData\Roaming\Mozilla\Firefox\profiles.ini to another folder during the installation (in my example, C:\temp) and then restore it to its original location after the installation is complete, in order to retain access to the user profile (containing bookmarks, passwords, etc.).
To do this, I have: `
from setuphelpers import *
uninstallkey = []
def install():
#copying the profiles.ini file from AppData to c:\Temp
print('saving the profiles.ini file')
filecopyto(user_appdata()+'\Mozilla\Firefox\profiles.ini','c:\Temp')
#killing the Firefox.exe process
print('closing Firefox')
killalltasks("firefox.exe")
#updating to Firefox 68.9.0esr (32-bit)
print('updating to Firefox 68.9.0esr (32-bit)')
install_exe_if_needed("Firefox Setup 68.9.0esr.exe",'/s',key='')
.....
Everything goes well when I run my installation from PyScripter on my development machine (running Windows 10 Pro); it correctly copies the profiles.ini file from C:\Users\Username\AppData\Roaming\Mozilla\Firefox\ to C:\Temp.
When I launch the installation of my package from the console to another machine (Debian 9 server, Wapt 1.7.4), I get an installation error:
IOError: [Errno 2] No such file or directory: u'C:\\Windows\\system32\\config\\systemprofile\\AppData\\Roaming\\Mozilla\\Firefox\\profiles.ini'
It is looking for the profiles.ini file in the wrong place.
I've tried various approaches, including using `
from os import path
appdatapath = path.expandvars('%APPDATA%')
filecopyto(appdatapath+'\Mozilla\Firefox\profiles.ini','c:\Temp')`
, but the problem persists: the package works fine locally on the development machine using PyScripter, but I get the same error when I try to install the package from the console on another test machine.
There's a subtlety I'm missing: why does my script look for the file in the correct location when I install from PyScripter, and then look for it in `C:\Windows\system32\config\systemprofile\AppData\Roaming\Mozilla\Firefox` when I install from the console?
Thank you in advance for your help.
Sincerely,
Cyril G
I'm trying to install a Firefox update package from version 52.9esr to Firefox 68.9esr.
The problem is that this version upgrade creates a new default user profile.
The idea is to back up the file C:\Users\Username\AppData\Roaming\Mozilla\Firefox\profiles.ini to another folder during the installation (in my example, C:\temp) and then restore it to its original location after the installation is complete, in order to retain access to the user profile (containing bookmarks, passwords, etc.).
To do this, I have: `
from setuphelpers import *
uninstallkey = []
def install():
#copying the profiles.ini file from AppData to c:\Temp
print('saving the profiles.ini file')
filecopyto(user_appdata()+'\Mozilla\Firefox\profiles.ini','c:\Temp')
#killing the Firefox.exe process
print('closing Firefox')
killalltasks("firefox.exe")
#updating to Firefox 68.9.0esr (32-bit)
print('updating to Firefox 68.9.0esr (32-bit)')
install_exe_if_needed("Firefox Setup 68.9.0esr.exe",'/s',key='')
.....
Everything goes well when I run my installation from PyScripter on my development machine (running Windows 10 Pro); it correctly copies the profiles.ini file from C:\Users\Username\AppData\Roaming\Mozilla\Firefox\ to C:\Temp.
When I launch the installation of my package from the console to another machine (Debian 9 server, Wapt 1.7.4), I get an installation error:
IOError: [Errno 2] No such file or directory: u'C:\\Windows\\system32\\config\\systemprofile\\AppData\\Roaming\\Mozilla\\Firefox\\profiles.ini'
It is looking for the profiles.ini file in the wrong place.
I've tried various approaches, including using `
from os import path
appdatapath = path.expandvars('%APPDATA%')
filecopyto(appdatapath+'\Mozilla\Firefox\profiles.ini','c:\Temp')`
, but the problem persists: the package works fine locally on the development machine using PyScripter, but I get the same error when I try to install the package from the console on another test machine.
There's a subtlety I'm missing: why does my script look for the file in the correct location when I install from PyScripter, and then look for it in `C:\Windows\system32\config\systemprofile\AppData\Roaming\Mozilla\Firefox` when I install from the console?
Thank you in advance for your help.
Sincerely,
Cyril G