.和..在路径中的区别
2015-10-20 11:45
141 查看
最近在做一个nwjs + nodejs + polymer的项目。项目快做好了,需要把代码打包成可以直接运行的文件。
本来的文件结构是:
app
--bower_components
--node_modules
--src
|--client
|--index.html
|--elements.html
index.html、elements.html里面对node和polymer的依赖的引用全写成了“../../node_modules/XXX”和“../../bower_components/XXX”的形式。
nwjs的打包文档要求把**.html全部挪到app目录下。挪完之后把依赖路径里的“../../“去掉,成为”node_modules/XXX“和”bower_components/XXX“。这时候再运行app,发现nwjs开始报错找不到node_modules里面某几个的包,polymer组件的加载也无法完成。
网上各种搜,找不到相关的资料。最后试着把在路径开头加上"../"或者”./“,成为”../node_modules/XXX“和”./node_modules/XXX“,发现问题居然解决了。卡了那么久,解决方案竟然如此简单,真是不知道说什么好。
.是当前目录,..是上一级目录。
http://stackoverflow.com/a/6008906/2177408
A
front of the URL is equivalent to the current path. So
both relative paths. In the answer you posted, you asked to remove the dot only, so the path of
translate as an absolute path instead of a relative path.
Edit: one more thing -
the current directory and
the parent directory. As phihag comments, these really should be avoided and protected against in code. Directory traversal can be used for evil.
本来的文件结构是:
app
--bower_components
--node_modules
--src
|--client
|--index.html
|--elements.html
index.html、elements.html里面对node和polymer的依赖的引用全写成了“../../node_modules/XXX”和“../../bower_components/XXX”的形式。
nwjs的打包文档要求把**.html全部挪到app目录下。挪完之后把依赖路径里的“../../“去掉,成为”node_modules/XXX“和”bower_components/XXX“。这时候再运行app,发现nwjs开始报错找不到node_modules里面某几个的包,polymer组件的加载也无法完成。
网上各种搜,找不到相关的资料。最后试着把在路径开头加上"../"或者”./“,成为”../node_modules/XXX“和”./node_modules/XXX“,发现问题居然解决了。卡了那么久,解决方案竟然如此简单,真是不知道说什么好。
.是当前目录,..是上一级目录。
http://stackoverflow.com/a/6008906/2177408
A
./in
front of the URL is equivalent to the current path. So
./delete-misc/test-ajax-code.phpand
delete-misc/text-ajax-code.phpare
both relative paths. In the answer you posted, you asked to remove the dot only, so the path of
/delete-misc/test-ajax-code.phpwould
translate as an absolute path instead of a relative path.
Edit: one more thing -
.is
the current directory and
..is
the parent directory. As phihag comments, these really should be avoided and protected against in code. Directory traversal can be used for evil.
相关文章推荐
- C#中返回值封装
- CCFlow新版本的自由流程、自定义流程功能说明
- Java中的static关键字解析
- CentOS 6.6下NFS安装配置
- 放置外链不被册的策略
- postgre笔记
- iOS 打开第三方导航
- RequireJS入门(二)
- Python点滴01——关于Python2.x和3.x的一些个人感受
- 搭建PHP环境
- IOS 宏定义
- 单链表的PushBack,PopBack,Insert...函数
- CCNA学习笔记1---OSI TCP/IP模型
- Svn 利用 乌龟解锁
- 复制Tomcat注意事项
- Android视频播放之边缓存边播放
- 30.Length of Last Word
- HTML5在欧亚冰火两重天
- IntentService解析
- iOS 关于UITableViewCell复用机制的理解