123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- let Fs = require('fire-fs');
- let Path = require('fire-path');
- const OutPut = Editor.require('packages://hot-update-tools/core/OutPut.js');
- module.exports = {
- manifestResDir: null, // 在creator2.4之后,res变为了assets
- getLocalIP () {
- let ip = '';
- let os = require('os');
- let ifaces = os.networkInterfaces();
- Object.keys(ifaces).forEach((ifname) => {
- ifaces[ifname].forEach((iface) => {
- if ('IPv4' !== iface.family || iface.internal !== false) {
- // skip over internal (i.e. 127.0.0.1) and non-ipv4 addresses
- return;
- }
- ip = iface.address;
- });
- });
- // let runPlatform = cc.sys.os;
- // let network = os.networkInterfaces();
- // if (runPlatform === "Windows") {//win
- // for (let i = 0; i < network.WLAN.length; i++) {
- // let json = network.WLAN[i];
- // if (json.family === 'IPv4') {
- // ip = json.address;
- // }
- // }
- // } else if (runPlatform === "OS X") {//mac
- // let ipDate = null;
- // if (network && network.en0) {
- // ipDate = network.en0;
- // }
- // if (ipDate) {
- // for (let i = 0; i < ipDate.length; i++) {
- // let item = network.en0[i];
- // if (item.family === 'IPv4') {
- // ip = item.address;
- // }
- // }
- // }
- // }
- return ip;
- },
- };
|