Permalink
Browse files

Problem with reload actions on windows

The fullFilePath of modules in windows contain "/" (
C:\appHero\actions/chat.js ) as folder structure. In the require cache
the files only contain "\" as delimiter between paths.

So the module in the cache can't be deleted and the new file isn't
loaded.

This fix replaces the "/" in the filepath.
  • Loading branch information...
1 parent 655ba95 commit 78c02f4eef75a8fced18b8dca25de5290e6f4383 Sebastian Dechant committed Mar 6, 2013
Showing with 9 additions and 1 deletion.
  1. +9 −1 initializers/actions.js
@@ -28,7 +28,15 @@ var actions = function(api, next){
if(curr.mtime > prev.mtime){
process.nextTick(function(){
if(fs.readFileSync(fullFilePath).length > 0){
- delete require.cache[fullFilePath];
+ var cleanPath;
+ console.log(fullFilePath);
+ if(process.platform === 'win32'){
+ cleanPath = fullFilePath.replace(/\//g, "\\");
+ } else {
+ cleanPath = fullFilePath;
+ }
+
+ delete require.cache[cleanPath];
delete api.actions.actions[actionName];
api.actions.load(fullFilePath, true);
api.params.buildPostVariables();

0 comments on commit 78c02f4

Please sign in to comment.