我已经用Python和Pyside开发了一个应用程序,并在Linux机器上开发。现在我想在Windows机器上部署它,但问题是路径。在Linux中,正斜杠(/)被用作分隔符,而Windows使用反斜杠(\)作为分隔符。因此,在Windows上并非所有路径都有效。应用程序中有多个路径(用于样式表、图像、日志等),更改所有路径很困难,因为大多数路径都是硬编码的。
有没有解决这个问题的方法?
rootPath()+'/static/images/add.png' #rootPath return os.path...
例子:
colorPickerBtnStyle = 'background:url(' + rootPath() + '/static/images/color_icon.png);background-repeat: no-repeat;background-position:center center;'
有没有解决这个问题的方法?